Hello Xavier,
actually the fileupload library is intended for the parsing of multipart
requests. It is only usefull on server side.
You can use the apache httpclient library (in addition with the
org.apache.httpmime and org.apache.james.mime4j libraries), in order to
achieve what you need:
BasicHttpEntityEnclosingRequest httppost = new
BasicHttpEntityEnclosingRequest( "POST", "
http://localhost:8182/testFileUpload");
// Get stream from file
FileInputStream fileStream = new FileInputStream( new
File("/path/to/file.txt"));
InputStreamBody streamBody = new InputStreamBody( fileStream,
"text/plain", "file.txt");
// Add a string
StringBody comment = new StringBody( "A binary file of some kind",
Charset.forName("UTF-8"));
MultipartEntity reqEntity = new MultipartEntity();
reqEntity.addPart("comment", comment);
reqEntity.addPart("bin", streamBody);
httppost.setEntity( reqEntity);
Best regards,
Thierry Boileau
> Hello,
> I would like to know how I can handle on the client side a formular with a
> file upload field type (
>
> <input type="file" name="datafile" size="40"> in html for instance)...
> I expect to use the FileUpload extension for doing this, but I don't know
> how to do it on the client side
> regards
> Xavier
>
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2639877