[Mono-list] File upload in asp.net and Path.GetFileName
David Temes
dtemes at infoco.es
Wed Oct 31 14:52:26 EDT 2007
In windows file upload is working fine, but in linux whenever I send a file with internet explorer it seems that the FileName property of the uploaded file contains "\" that Path.GetFileName does not interpret as path separator.
So if I try to upload from my windows machine using IE the file c:\test.jpg to later save it in /tmp I end up with c:\test.jpg being the file name returned by Path.GetFileName (instead of just test.jpg) and trying to save a file as /tmp/c:\test.jpg, and that throws an exception.
Firefox for instance send only test.jpg as file name and it works fine.
Now my questions:
1- is there a best way to solve this problem?
2- if no, is turning every \ into / before using Path.GetFileName a good strategy or is it a bad practice?
3- Why does IE send all that path information?
Thanks in advance and regards
David Temes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-list/attachments/20071031/8a1599aa/attachment.html
More information about the Mono-list
mailing list