You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Brian Johnson <br...@u.washington.edu> on 2007/05/09 02:25:48 UTC

Sending a String as (Post) File?

I'm trying to give an Applet an http-based "file system" using httpClient 
on the applet end and simple php scripts for directory listing and 
file-upload on the server end.  To 'save' to the server I wish to upload a 
lump of stuff (text for now, in the applet) to the server as if it were a 
file uploaded from a multipart form element via POST. Since the Applet 
won't have local file permissions, I can't save to and then point at a 
local file to upload. I've read the MultipartRequestEntity description and 
it seems that the FilePart constructor wants only File objects. The 
String part is for Name-value pairs in traditional HTML form sytle. I 
can't imagine it's that hard, but I don't see how to turn my String into 
a 'File'. What am I missing here?

   -Brian Johnson, Dept of Architecture, University of Washington

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Re: Sending a String as (Post) File?

Posted by Roland Weber <RO...@de.ibm.com>.
Hello Brian,

> I've read the MultipartRequestEntity description and 
> it seems that the FilePart constructor wants only File objects. The 
> String part is for Name-value pairs in traditional HTML form sytle. I 
> can't imagine it's that hard, but I don't see how to turn my String into 

> a 'File'. What am I missing here?

Please implement a new class StringAsFilePart, combining the
elements from FilePart and StringPart that you require.

hope that helps,
  Roland