• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Implementing file upload like CURL

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My client has some CGI solution to uploading files in your server. Is a perl script who deals with curl clients, sending requests with files to upload.

In Curl manual (http://www.hmug.org/man/1/curl.php), the solutin for upload files is described as using -F clause, "This causes curl to POST data using the Content-Type multipart/form-data according to RFC1867"

I try to use HttpClient and java.net solutions, and I write some code. But I had two problems:
-> In some cases, parameters ('action', 'filename', etc) are not readed from CGI
-> If parameters was loaded OK, the file was not found !



My first code, using HttpClient (based in PostMethod class to do the POST):



My next try was to write in an outputstream:



In this two examples, parameters are readed, but not the file.
Because the perl CGI reads the file as standard in (some like "$_"), I don�t know how this solution could be implemented.

Has someone leads with curl or another similar solution (in CGI) to uploading files ?
 
Just the other day, I was thinking ... about this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic