I have my projec where I upload a file and it insets it into a DB. When I run my project in eclipse everything works like a charm, howeve when I export my project to a .war file and deploy in my Tomcat Server and try to upload the same file. I get the following error.
I noticed that for some reason a .jar from is not getting exported, so I added it manually to my .war file but this still does not solve my problem, what am I missing or doing wrong. Or is it just simply that since my file is on my local computer then the server cannot find it? If so, how do I pass a path to the server from my local computer to use that file and insert it to a DB. This is my current method that works if I run my app in eclipse.
You should not be giving the local file path as a request parameter. if you requirement is to upload a file and then insert that into db then you will require 3rd party jars like commons-fileupload
to upload the file to servlet and then you can save the uploaded file to db.
Eduardo Ponce de Leon
Joined: May 13, 2009
ok! Maybe I didnt explain myself, I am not trying to save the file to the dabase. I am trying to open the file with OpenCSV read the file, take the colums that I need and Insert them into my database. But I am unsure on how to do all this from the server.
Joined: Jan 22, 2007
Ok, don't save the file into database if not required. But still you will need to upload the file through 3rd party lib like commons-fileupload and you will receive a byte array at server side. Now you can do whatever you want to do with byte. You can create a File object and extract the desired columns out of it.