| 
	
 | 
 Posted by Lee on 06/19/08 11:52 
Thanks, I'll try this! 
 
Gertjan Klein wrote: 
> Lee wrote: 
> 
> >The only way that the entire string would transfer in the post request 
> >was if I used urlencode. 
> 
> That doesn't sound like the right approach to me though. PHP will have 
> to have the entire image in a string, instead of just writing it to a 
> file. This may give problems on larger images. 
> 
> I'd still suggest you change your applet to use the standard post method 
> that browsers use. You'll need a header stating the Content-Type is 
> multipart/form-data. The posted contents needs to be formatted like a 
> MIME message. As far as I can tell you don't need to encode the data in 
> any way. (A quick test using tcptrace shows that at least firefox posts 
> image data unencoded.) 
> 
> I am in no way qualified to give Java advice (and this is not the 
> newsgroup to give it in), but you may want to try using the apache 
> commons HTTP client class: 
> 
> http://jakarta.apache.org/commons/httpclient/ 
> 
> I have used it successfully in the past to post data to a server. It 
> takes care of all the low-level details for you, and can post the image 
> contents in a browser-compatible way. Doing it this way you know that 
> the PHP side will be trivial, as PHP will save the posted data in a file 
> for you. 
>  
> HTH, 
> Gertjan. 
>  
> --  
> Gertjan Klein <gklein@xs4all.nl>
 
  
Navigation:
[Reply to this message] 
 |