This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Servlets and the fly likes uploading an image functionality Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "uploading an image functionality" Watch "uploading an image functionality" New topic
Author

uploading an image functionality

Rina Khan
Greenhorn

Joined: Dec 23, 2003
Posts: 1
Hello,
COuld someone kindly explain the process of uploading your pictures on some of the websites where a user enters his profile and then, upload an image. I'm not looking for a code just curious as to how it works and what kind of technolgies (Servlets or Javascript) they use.Im a beginner in all this and jsut want to add to my knowledge. Again, not looking for a code , just want to know the process and whats best to use (Java or Javascript)..hope i made my questions clear. THanks.
Malhar Barai
Author
Ranch Hand

Joined: Aug 17, 2001
Posts: 399
Hi Rina,
Its the same as file Upload, you can upload any sort of file. You can use various file upload components for that or write your own. And thats basically done using Servlets.
hth
MB


Malhar Barai
SOA & Java Book
Torsten Schippel
Ranch Hand

Joined: May 09, 2003
Posts: 62
Hi Rina,
as Malhar stated its just a normal file upload. You do not need any JavaScript. In fact it is a normal post like any other form submission. The only difference is the encoding. The normal form POST is "application/x-www-form-urlencoded". The file upload is "multipart/form-data".
Using normal POST (login for example) your server component get just String like:
name=John&pasword=xxxxx
Using multipart/form-data POST your server component get something like:
Content-type: multipart/form-data, boundary=---AaB03x
-----AaB03x
content-disposition: form-data; name="anyField"
fieldData
-----AaB03x
content-disposition: form-data; name="upfile"; filename="image.jpg"
Content-Type: image/jpeg (depending on file type)
... image data...
-----AaB03x--
The server component which will decode it will be a servlet in Java. The servlet may use existing classes like
http://www.servlets.com/cos/javadoc/com/oreilly/servlet/MultipartRequest.html.
HTTP file upload is defined by
RFC1867
HTH
Torsten
[ December 23, 2003: Message edited by: Torsten Schippel ]
Brian Pipa
Ranch Hand

Joined: Sep 29, 2003
Posts: 299
Any number of technologies can do http file uploads. For a servlet/.war solution, see:
http://filenabber.com/filenabber.html
For a nice PHP solution, see
http://gallery.sourceforge.net/
Brian


My Java Freeware:<br />MACCC - <a href="http://maccc.pipasoft.com" target="_blank" rel="nofollow">http://maccc.pipasoft.com</a><br />Nator - <a href="http://nator.pipasoft.com" target="_blank" rel="nofollow">http://nator.pipasoft.com</a>
 
Consider Paul's rocket mass heater.
 
subject: uploading an image functionality