Link to home
Start Free TrialLog in
Avatar of bakyaraj
bakyarajFlag for United States of America

asked on

File Uploading - Help - Urgent...

Hi Guys,
I have got a requirement to upload a file from the client machine through  JSP and save it in the oracle 8i database as Blob.
Another thing, I need to retrieve the same Blob object from the database and show it in the screen as image.

How to do it?
I am using Iplanet web server.

Can anyone give me a solution(if possible with sample coding in working condition!)?

It's very urgent.


Avatar of vivekphanse
vivekphanse

We have used smartupload component to do that, Unfortunately it wasn't in my module, so i can't help much but you can refer to the site below and download this component, its FREE!!!

http://www.aspsmart.com/

on this site u wil find the component under the link of "aspSmartUpload".

all the best.

thanx
vivek
Avatar of bakyaraj

ASKER

vivek i am using JSP not ASP.

yeah but still u can use it yaar.....we also made the whole project on JSP only file uploading component was from ASP. If that wont work then sorry for giving u a wrong advice, and if u find such type of JSP compo. then please tell me also about it.

thanx in advance
vivek
There is a reference book titled "Java Servlet Programming" published by Oreilly. You can go to www.oreilly.com and download the source code of that book. You can make used of the MultipartRequest class for the file uploading stuff.

good luck.
hi vincent,
i am using the package provided by oreilly(MultipartRequest) . But what i need is , the file should be stored in database as blob. Then the same blob object should be retrieved and shown in the screen along with the other fields.

do u have any suggestions?
oic. i have done it with MultipartRequest with some modification in my last year project.

1. blob to oracle part:
=> I think you can handle it, it's easy.

2. For the display part, there are many methods.
a) Use one SQL for all fields include the blob. Then use a filestream to create a physical file on server. And display that link to client with other fields.

b) Use one SQL for the blob and another SQL for other fields. For other fields, you can handle it as usual. For the blob field, you can write a individual page for it and include some caller in the main page such as  
<img src=<%=photoJSP.jsp?BLOBID="ABC123"%>
<a href=<%=exeJSP.jsp?BLOBID="ABC456"%>
to get the blob.

Set the Response.contenttype to the file type of your file (eg jpg, gif, exe, zip). And write all the blob data to the jsp directly. This method would not create a physical file in server but consume one connection for one blob.
Hi Guys,
I am able to store the file in the database and as well as able to retrieve but there is one limitation. If the file exceeds 3900 bytes(approx.) then the setobject method of preparedstatement stores null value. I tried setBinaryStream, it allows only 2000 bytes.

I am using oracle thin driver. I think the problem is with the driver.

Can anyone suggest proper driver?
ASKER CERTIFIED SOLUTION
Avatar of vasan_sr
vasan_sr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
no comments
how bout jspSmartUpload (also free)
http://www.jspsmart.com/
bakyaraj:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
Recommendation -> Split points b/w vasan_sr and woodstock
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:


[split points between vasan_sr and woodstock]


Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
sudhakar_koundinya
EE Cleanup Volunteer
---------------------
If you feel that your question was not properly addressed, or that none of the comments received were appropriate answers, please post your concern in THIS thread.