开发者

How do i get the file name from an asp.net fileupload control that works in IE and FireFox?

开发者 https://www.devze.com 2023-03-02 16:02 出处:网络
In firefox i do ge开发者_如何学Ct the file name (not the full path from where the file is uploaded) using fileuploadID.postedfile.filename. But the same thing retrieves full path (from where the file

In firefox i do ge开发者_如何学Ct the file name (not the full path from where the file is uploaded) using fileuploadID.postedfile.filename. But the same thing retrieves full path (from where the file is uploaded) in IE.

Any one please tell me how to get the filename browser compatibly.


Firefox by default sends only the filename. But that should be enough to get the name. Once you get the name, it is enough for you, because it is already uploaded to the temp folder (location is unimportant). Once you have the filename handle, you can copy it wherever. Alternatively, you can use Path.GetFileName(filename) that should get you the same results in both the browsers....

http://msdn.microsoft.com/en-us/library/system.io.path.getfilename.aspx

0

精彩评论

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