• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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 ?
 
No, tomorrow we rule the world! With this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic