Hi Mary, It seems to me you are experiencing another problem altogether. The Struts upload example shows how to use its file upload classes to upload a file to the file system. It does not indicate how to store and retrieve files as BLOBs in a database. I won't be of much use for the latter question as I've never designed a database for use as a file repository :-) Sorry about that. Darryl
You should be able to find the upload samples in the jakarta-struts-1.0.2-src package, buried somewhere under the src/upload directory. HTH.
posted 16 years ago
I got an email from a fellow rancher requesting me to provide sample code related to file upload in Struts. I was able to successfully implement the file upload functionality in production and here is the code require to do so..
JSP Code: This code sets up the html form for upload requests. Note the form tag with the encoding type set to multipart-form data. Use the html:file tag for the text box that will be used to specify the file that needs to be uploaded. This will automatically provide a "Browse" button.
In your ActionForm class: The following lines are important
In the action class that will process the uploaded file:
I know how to upload and download a file stored in the server with struts, what i don't know is how to update these file, how i can reuse my ActionForm in order to make and update of the file. In my app the file is saved in postgres.
this is ganesh ,i implement ur code for uploading the file in struts, the flow is going fine,but the file is not uploaded any where. I also implented controller ,code i specified below, still the file is not getting uploaded any where.
While the code in the above posts shows something about how to read an uploaded file, none of the posts show code to save the file on the server. If you are unfamiliar with how to write a file, This link should help. [ June 25, 2006: Message edited by: Merrill Higginson ]