firefox vs ie textbox probs (Full Version)

All Forums >> [Web Development] >> General Web Development



Message


yogaboy -> firefox vs ie textbox probs (10/27/2005 17:22:57)

Good e'en

I'm building a file upload page in .net and using an html input control of type file eg <input type="file".... , but firefox and ie are returning different strings.

Firefox returns just the filename eg myfile.txt and not the path to the file, and IE is returning the full path ie c:\mydir\myfile.txt

I was wondering if anyone else had come across this or any ideas how to get them to behave the same?




jaybee -> RE: firefox vs ie textbox probs (10/27/2005 17:59:01)

Sounds like a .net issue. I have no idea how well FF handles it. Is there a .net forum around? If so I'd check there as somebody else is bound to have come across it.




yogaboy -> RE: firefox vs ie textbox probs (10/28/2005 7:15:33)

Ok. Thought I'd check here first to see if it's just a general input control issue before trawling the .net angle.

Thanks.




yogaboy -> RE: firefox vs ie textbox probs (10/28/2005 9:50:41)

Ok, I've found an answer through a bit of fiddling around with code, so I'll post it up incase anyone else comes across this with the same problem (how thoughtful I can be! [:)] )

instead of accessing the filename through
string filename = File1.PostedFile.FileName;

where File1 is the id of the input control, use this instead

System.IO.Path.GetFileName(File1.PostedFile.FileName);


and to get the dir use System.IO.Path.GetDirectoryName or any other overload you need. This will harmonize the returned values from FF or IE etc.




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.046875