Client to server fileupload using commons into database - beginner
posted 10 years ago
The problem: I wrote code using commons fileupload in a servlet which worked until I moved the code into production causing the file path(from client browser) to not exist(on sever). Doh.
So, I posted a message on here asking for some help and someone stated I should use the file input stream. I have been reading and searching so many articles, tutorials and messageboard threads that I am now completely confused and intimidated by this. I dont know what I am doing wrong or where to start!
What I need to get accomplished is this: The should be able to select a file off their local machine and upload it into the database - the actual file will upload in binary format and reside in the db.
There doesnt seem to be an abundant amount of examples of this out there or if there are I havent been able to find them.
1.) First of all, I dont really understand how the client and server relationship works. If I get a local machines' path and try to process this on the server side(via a servlet) then that path will not exist, correct?
2.) If the previous statement is true - then would I not want to process the fileupload in a servlet at all? Or, even how can I resolve the actual path to use. Is this even possible? This just confuses me.
I think I have the right code to upload the file and save it as a binary blob in the database. It works but just not from a client machine.