Results 1 to 8 of 8
  1. #1
    JavaDreams is offline Member
    Join Date
    Jan 2011
    Posts
    18
    Rep Power
    0

    Unhappy Image Upload,Please help

    I am making a very simple website as my minor project, in which i will ask user to upload photo and save it in the BLOB field of my database.
    I have created a form.
    Java Code:
      <form action="SavePic" method="post" enctype="multipart/form-data"
               name="productForm" id="productForm">
    
             Please Upload Your Profile Picture
    
             <input type="file" name="file" id="file">
    
             <input type="submit" name="Submit" value="Submit">
    
           </form>
    Now please help me how to fetche the image in servlet and store in BLOB field of Database.
    I am stuck, please Help!!
    |SCJP-1.6 91%|

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

  3. #3
    go4soumya is offline Member
    Join Date
    Oct 2010
    Posts
    32
    Rep Power
    0

    Default

    hi JavaDreams.

    Use apache upload commons to fetch the file from the client side to the server. It comes with a pretty good documentation, and you won't have too much problem in writing the servlet (as u're signature suggests!). Rest inserting it into the database is a pretty easy! ..try it

    good luck :)

  4. #4
    JavaDreams is offline Member
    Join Date
    Jan 2011
    Posts
    18
    Rep Power
    0

    Smile

    Quote Originally Posted by go4soumya View Post
    hi JavaDreams.

    Use apache upload commons to fetch the file from the client side to the server. It comes with a pretty good documentation, and you won't have too much problem in writing the servlet (as u're signature suggests!). Rest inserting it into the database is a pretty easy! ..try it

    good luck :)
    Thank you soumya,
    For your valuable opinion and time to write it.I' am exploring the Apache FileUpload and will surely implement it.
    And post a reply if i succeed.
    Thank you again.
    Have a nice day!
    |SCJP-1.6 91%|

  5. #5
    JavaDreams is offline Member
    Join Date
    Jan 2011
    Posts
    18
    Rep Power
    0

    Default

    With all your guidence i am able to getting a image file uploaded and save it in a folder on my disk.
    Bust just a single error.
    When i upload image, it doesn't come when i call it with the <Img> tag. But when i run the whole program again it comes.
    So am i missing any thing??
    |SCJP-1.6 91%|

  6. #6
    go4soumya is offline Member
    Join Date
    Oct 2010
    Posts
    32
    Rep Power
    0

    Default

    Hi javadreams,

    With all your guidence i am able to getting a image file uploaded and save it in a folder on my disk.
    good to hear that!!... :o

    if u have succeeded in uploading the image, displaying it with the image tag shouldn't be a problem after a refresh. image tag just displays the image as specified by its src attribute...that's the concept and that's how things work.
    U must be missing something which is not clear to me....so please elaborate your problem a bit, specially when i run the whole program part or check your code once again...ok??

    good luck!

  7. #7
    JavaDreams is offline Member
    Join Date
    Jan 2011
    Posts
    18
    Rep Power
    0

    Default

    Thank you everyone and specially Go4Somya with all your help, i was able and submitted my project
    SOCIAL NETWORKING WEBSITE successfully.
    Thanks a lot once agai.
    |SCJP-1.6 91%|

  8. #8
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. How to upload image in jsp/servlet
    By ibhaviik in forum Java Servlet
    Replies: 11
    Last Post: 11-16-2010, 12:32 PM
  2. Upload Image / Document
    By systech44 in forum Java Servlet
    Replies: 1
    Last Post: 09-02-2010, 03:10 PM
  3. Upload an image.
    By dudejonne in forum Java Applets
    Replies: 13
    Last Post: 11-11-2009, 07:04 PM
  4. How to upload image into server
    By vinodkonatala in forum Advanced Java
    Replies: 2
    Last Post: 10-15-2008, 01:10 PM
  5. Image upload applet 2.0
    By jfileupload in forum Java Software
    Replies: 0
    Last Post: 03-24-2008, 05:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •