开发者

$_FILES['file']['tmp_name'] equivalents in C#

开发者 https://www.devze.com 2023-03-17 16:51 出处:网络
what is equivalen开发者_如何学Pythonts to $_FILES[\'file\'][\'tmp_name\'] of PHP in C#.net?The equivalent in ASP.NET is:

what is equivalen开发者_如何学Pythonts to $_FILES['file']['tmp_name'] of PHP in C#.net?


The equivalent in ASP.NET is:

Request.Files["file"].SaveAs("Your filename");

ASP.NET do not expose the temporary filename which is used during the file upload.

If you want to validate the contents of the file you could read from Request.Files["file"].InputStream.

More information at MSDN: http://msdn.microsoft.com/en-us/library/system.web.httprequest.files.aspx


If you mean APS.NET there is no such analog. But why you really need it?

in asp.net you can use HtmlInputFile control and then check it PostedFile property

HtmlInputFile filMyFile;
if( filMyFile.PostedFile != null )
{
    // File was sent
    HttpPostedFile file=filMyFile.PostedFile;
}
else
{
    // No file

}

Look more detail on msdn

0

精彩评论

暂无评论...
验证码 换一张
取 消