Thanks for the link!
The problem I have is that i do not exactly know how to write a servlet
that serves a source for the file upload. Here my problem:
I have a html page that has a input field "file" that will contain the file
name to upload
and a submit button whose action will have to result in writing the file to a
server side
location and display a page accordingly.
The html page:
<form method='POST' ACTION='http://<machine>:<port>/UploadWebFilePage'
enctype='multipart/form-data'>
<input type='hidden' name='page' value='upload_onlinefile_form'>
<input type='hidden' name='next_page' value='save_onlinefile_info'>
<input type='hidden' name='id' value='10612'>
<input type='hidden' name='target' value='edit_view'>
<h2>Upload file for: TestX Rev. 2.0</h2>
<div>
<input type='hidden' name='view_id' value='7520'>
<b>View:</b> one_pager<br>
<br>
File to upload: <input type='file' name='file' size='50'><br>
<br>
<br>
<input type='submit' name='submit' value='Upload File'>
</div>
</form>
How can the UploadWebFilePage servlet read the data in the given file into
another file and create a response that
is of "text/html" MIME type meaning a regular html page? I do not need a
"Save to disk" window appearing asking me to choose where to store
the file because I will evaluate the destination automatically depending on
some of the above hidden input fields.
Thanks.
Astrid
Christophe Vanfleteren wrote:
> Astrid Wagner wrote:
>
> > Hi,
> > I want to write a servlet that uploads a file.
> > I read some about that the content type has to be multipart/formdata but
> >
> > I would like to have a little example on this.
> > Can someone help?
> > Thanks.
> > Astrid
>
> You could use http://jakarta.apache.org/commons/fileupload/, it does what
> you need.
> --
> mvg,
> Christophe Vanfleteren