移动ASP的上传文件(move uploaded file for ASP)

编程入门 行业动态 更新时间:2024-10-23 02:08:39
移动ASP的上传文件(move uploaded file for ASP)

我知道用PHP移动上传的文件

<?php if( isset($_FILES["myfile"]) ) { $target = basename($_FILES["myfile"]["name"]); if(move_uploaded_file($_FILES["myfile"]["tmp_name"],"./temp/".$target)) { $res = array("success"=>true,"file_name"=>$_FILES["myfile"]["name"],"size"=>$_FILES["myfile"]["size"]); } else $res = array("success"=>false,"desc"=>"no"); echo json_encode($res); } ?>

但我不知道ASPX。

现在我需要ASPX中的PHP(上面)等文件上传代码。 任何代码来解决我的问题?

预先感谢。

I know move the uploaded file in PHP

<?php if( isset($_FILES["myfile"]) ) { $target = basename($_FILES["myfile"]["name"]); if(move_uploaded_file($_FILES["myfile"]["tmp_name"],"./temp/".$target)) { $res = array("success"=>true,"file_name"=>$_FILES["myfile"]["name"],"size"=>$_FILES["myfile"]["size"]); } else $res = array("success"=>false,"desc"=>"no"); echo json_encode($res); } ?>

But I don't know the ASPX.

Now I need file upload code like PHP(above) in ASPX. any code to solve my problem?

Thank in advance.

最满意答案

有一个很好的例子: http : //msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.fileupload.aspx

只需使用FileUpload.SaveAs(...)函数将上传的文件保存在服务器上的所需位置即可

There is a good example at: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.fileupload.aspx

Just use the FileUpload.SaveAs(...) function to save the uploaded file where you want on the server

更多推荐

本文发布于:2023-08-07 17:48:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1465095.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:上传文件   ASP   move   file   uploaded

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!