chinmaya mishra

Greenhorn
+ Follow
since Jun 09, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by chinmaya mishra

Ruchika Kapoor wrote:Thanks Ulf Dittmer!

Your suggestion worked.



Hi ruchika,

Can you post your code here? i am also facing the same problem.

15 years ago
JSP
can any ony one help me in this regard?
15 years ago

Nur Mohammad Shahin wrote:Do you have the 'commons-io.jar' in your class-path?

If you are using 'commons-fileupload.jar' then it is dependent on 'commons-io.jar'.
So, you have to keep the 'commons-io.jar' in your class-path.





Thank you very much Shahin.
15 years ago
test.html


InsertMessage.java



when I am compiling this java file it successfully get compiled. when i m running it in toncat i am getting some exception


like:


exception

javax.servlet.ServletException: Servlet execution threw an exception

root cause

java.lang.NoClassDefFoundError: org/apache/commons/io/output/DeferredFileOutputStream
org.apache.commons.fileupload.disk.DiskFileItemFactory.createItem(DiskFileItemFactory.java:196)
org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:358)
org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.java:126)
InsertMessage.doPost(InsertMessage.java:46)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)



can any body help me in this regard?
15 years ago

Ulf Dittmer wrote:What do you mean by "upload to the database"? Do you wish to store the bytes that make up the file in a binary field in the database? If so, you can use an attribute of type BLOB.

Servlets can handle file uploads by way of the Apache Commons FileUpload library.





I want to store the txt file in database so that the same file i can retrieve and see the content. i will store file in db as BLOB. can you send me the servlet code.
15 years ago
Thank you for your reply.

Do i need to add any jar file to my class path for the package "org.appache.commons.fileupload"

because when i compiled it i got error as that package/class can not be found.

if i need to add any jar file can you tell me that jar file name.

thanks
15 years ago
I have a web application which will uoload the file into data base(oracle).

i have html file to browse file as "upload.html"

<form action="x">
File: <input type="file" name="upFile">

<input type="submit" name="submit" value="upload">
</form>


my servlet code is:


import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class InsertMessage extends HttpServlet{

public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException{

response.setContentType("text/html");

PrintWriter out=response.getWriter();


//what Code to upload the file to database.

}
}




Can any body help me in this regard?

can somebody send me the servlet code for the same?




15 years ago