Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Image Upload

 
Deepa Balasubramanayam
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am developing a website which does Auto sales. Users who are interested to sell their cars, has to enter their car details and necessary images of the car. Following is my question:
How to allow users to attach their car images to the submission form and how to store them? .
Thanks,
Deepa
 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your form tag must have:

You might want to check the oreilly classes by Jason Hunter, or JSPSmartupload, to upload files to your server. Very easy to use.
some developers store the full path name of the image and others store the image as a BLOB type.
hope it helps..
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another good package (And one completely free) is the Jakarta Commons FileUpload
 
Michael Zalewski
Ranch Hand
Posts: 168
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I recommend Jakarta.
The oreilly package was never meant to be deployed in a production setting. For example, if two users both upload a picture named "struggle_buggy.jpg", oreilly will overwrite the second file with the first one. Jakarta will let you upload the file directly to memory, or to a temporary file if the size is greater than some programmable limit.
I don't think that the oreilly package is junk. I think Jason Hunter did the Java community a wonderful service by releasing this code. I just think it was written only to show how file uploads work, and never meant to be deployed as a component in an enterprise web application.
 
Deepa Balasubramanayam
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you. Please suggest which is best
Storing images as blob type or
storing the path of the image ?.
Thanks,
Deepa
 
Rohit Ahuja
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Deepa,
Were i in thy place i would have definately gone for something like this.
I would never go in for storing images in the database.Make a seperate column(img_cd) within ur database for every user.So every user has a img_cd associated with him, make another table which has img_cd as primary key and img_description as another column, this column holds ur path where u store ur image.
The trick that i am using runs pretty much on the same lines as our very old and sweet term normalisation in databases.
So u have the path of ur image, just get it and display.
Was that a quickie or a bouncer or were u able to digest that explanation.
Do reply either way,
I'll try to think of an alternate solution in the meantime.
 
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also recommend the Jakarta Commons FileUpload library. From a recent blog entry...
With my new blog, I wanted to give myself the ability to upload new images to my host via the web so that I can use them in my blog entries. Normally I'd use FTP or webdav, but we've got an annoying firewall in the way at work.
As a solution, I decided to implement a simple file upload via a HTML (multipart encoded) form. After a quick google, I came across several, but the one that got my attention was Jakarta Commons FileUpload. All I can say is wow. In just a few lines of code you can extract an uploaded file from the HTTP request and save it to disk. I'm wondering what other goodies are waiting to be discovered!

HTH
Simon
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic