views:

322

answers:

1

I would like to send a file using the POST command available on almost all linuxes which include Perl.

I'm wondering how..

i would like to do something like :

linux:currentdir/$ POST http://www.example.com/upload.php > myFileToUpload

I guess i had probably to encode the file, i'm right, it's in base64 ? Isn't it ? I also read in the man that i'm able to set the Content-Type header, should it be set with 'multipart/mixed' ?

Thank you.

+1  A: 

You might consider looking into Curl. It is much more robust. An example of automating a file-upload form submission would be:

<form method="POST" enctype='multipart/form-data' action="upload.cgi">
  <input type=file name=upload>
  <input type=submit name=press value="OK">
</form>

Then use the command

curl -F upload=@localfilename -F press=OK http://www.example.com/form.cgi
Aiden Bell
thank you, i didn't really know about curl until know.Sounds interesting.
Boris Guéry
No problem :) ...
Aiden Bell