How do i get the file name from an asp.net fileupload control that works in IE and FireFox?
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
精彩评论