A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Uploading a file using the FileUpload control was failing only with IE8
Joined: Feb 22, 2006
Jan 04, 2010 23:29:08
In my application I store location of local files attached .
Now IE8 has option to include the local directory path for the Internet Zone on the client-side.
Default value is false ,as a result IE7 and IE8 has different behaviour.
Content-Disposition: form-data; name="targetFile"; filename="C:\Users\<username>\Desktop\abc.txt"
· IE 8
Content-Disposition: form-data; name="targetFile"; filename="abc.txt"
Now , I can not say every user to change IE8 setting.I want to fix it in my code.
Please help me out.
Thanks in advance
Joined: Oct 25, 2008
Jan 05, 2010 07:25:40
Can't you do something like this:
String s = "C:\\Users\\<username>\\Desktop\\abc.txt"; // String s = "abc.txt"; int last = s.lastIndexOf("\\"); if(last != -1) s = s.substring(last+1); System.out.println(s);
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Author and ninkuma
Joined: Jan 10, 2002
Jan 05, 2010 08:17:50
That is a security hole in IE7 that has been fixed. All browsers other than IE do not give you the local file path either.
It's IE7 that's broken, not IE8. You should not be relying upon the local path.
Asking smart questions
Books by Bear
I agree. Here's the link:
subject: Uploading a file using the FileUpload control was failing only with IE8
Uploading a file to the server(oreilly's MultiPartRequest class)
Cannot get filenames
Content-Disposition: Download file name problem
file upload using flex and jsp getting extra things...
how to include file-separator in fileName?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015