A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
IOException while retrieving file path from <input type=file>
Joined: Mar 28, 2012
Apr 03, 2013 08:19:04
When i try to retrieve the image file from the jsp page from the <input> tag it gives excception.
I`m construting my File using the file path that is selected by user in the <input> tag
<input type=file accept=image/gif name='browse'>
File f=new File(s); //this line results in runtime exception
but when directly give it absolute path of image like File f=new File("C:\Users\Mahtab\Desktop\pic.gif");
it works without exception.
So the problem is in constructing the File object .
Please give some solution to this problem
Oracle Java Programmer , Oracle SQL Expert , Oracle Java Web Component Developer
Author and ninkuma
Joined: Jan 10, 2002
Apr 03, 2013 08:23:00
You cannot use file I/O to upload a file. File I/O can only access local files. Please see the
for information on how to upload files.
Asking smart questions
Books by Bear
I agree. Here's the link:
subject: IOException while retrieving file path from <input type=file>
reading a private method within a class
Form is not submitting on TAB navigation
javax.imageio.IIOException: Can't create an ImageInputStream!
Form is not submitting when I use the TAB for navigation
Image on file upload browse button
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014