[Mono-list] File upload in asp.net and Path.GetFileName

Juraj Skripsky js at hotfeet.ch
Wed Oct 31 17:09:49 EDT 2007


This problem has been fixed (see
https://bugzilla.novell.com/show_bug.cgi?id=MONO82059).
HttpPostedFile.FileName will contain a filename with everything up to
(and including) the last '\' stripped away automatically. The next
version of Mono (1.2.6) will contain the fix.

- Juraj

On Wed, 2007-10-31 at 19:52 +0100, David Temes wrote:
> 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. 
> 
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list



More information about the Mono-list mailing list