There is an interesting issue with FileUpload and IE browser.
Say, you have the following piece of code in the code behind:
string fileName = file.PostedFile.FileName;
If you upload the file from
Firefox browser
, you will get
only the file name (Without any path) in the fileName variable (Say,
AutoPlay.jpg
)
But, if you upload the file from
IE
, you will get the
File name along with the path in the user's computer from where the file is uploaded (Say,
"C:\Users\shubho\Desktop\AutoPlay.png"
). Note that, this path is not the path in the web server, this is the file path in client's PC.
Ideally, the file name should not contain the directory path and I don't know why IE does that (A bug?).
May be, while you are testing from your PC (Not from within the server), you are using a non-IE browser and hence, you are not seeing the file path.
Any way, you should code your program based upon the file name only, not based upon the file path of user's PC(That is sent by IE only).