This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
1.) Did you import the java.io.File class first before using it?
2.) You should the error message if you get an error and only post if you didn't understand the error.
3.) Do not write Java processing logic in JSPs. Use a servlet for that. JSPs should only be used for presentation.
4.) Do not use the odbc driver. Find a jdbc driver from your database manufacturer and use that.
5.) Always close statements and connections in the finally block of a try/catch.
actually in your code File f=new File(request.getParameter("fileName")); the value of argument is null.
when you use <input type="file"> you will not able to get the data from that page using request.getParameter(String) otherwise you will get null . you have to follow some instruction as follows :
1.> you will have to write enctype="multipart/form-data" as an attribute in your <form > tag.
2. when you will have to get tha data first you will have to check that field was type file or type text, because now there are two type of data is coming from that page text & file.
3. you will have to add two jars to your project Library named commons-fileupload-1.2.2.jar and commons-io-2.4.jar jars version may be changed.
description The server encountered an internal error () that prevented it from fulfilling this request.
javax.servlet.ServletException: Wrapper cannot find servlet class upload.UploadImage or a class it depends on
hello Megha now i m giving you the whole code ...but before it you just clean and build your project ... and in the project directory on your disk...within the dist/web/ create an folder named images where your images will be uploaded ...and then run my full code.
my jsp is