how do i transfer images from the client to the server using only core java (no jsp and servlets)?
the scenario is, the user uploads an image from the form, with the user specifying the location of the image like "C:\images\img.jpg", and i have to copy it from his computer to the server using http. i was playing around with URL and URLConnection but was having issues regarding the url, cause i can't work out a way to convert the image path to http path.
i know i'm doing it wrong and would like to know the best way to implement the problem.
im implementing both client side & server side code for this problem. im using an mvc architecture where the jsp collects the data which in this case is the path to the image on the client's terminal, and the jsp & servlet transfers control to the model (a bunch of java files) and the model is supposed to perform the transfer of files.
the "methodology" for this project limits the way the jsp & servlets work in a way that those 2 does not do much server side other than passing the data to the model. im actually using JBoss for this project (so i think that is an http server).
I'm still confused ... is the client a browser or a Java program?
For a browser client, you can put a file upload control in an HTML form:
When the user submits the form, the browser sends a multi-part MIME request to the server. This is all to HTTP standards, but it's a bit tricky to read these requests on the server. Fortunately there are libraries around to do the job for you when the form posts to a servlet.
For a Java client, you can use sockets or a library for FTP. See the Sun Networking Tutorial for a good start on sockets.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi