I’m trying to figure out how to get a server to accept a file through HTTP post in one step – without going through all the trouble of creating an html form and clicking the submit button.
I know how to write a PHP/HTML package that accomplishes the following:
- user points their local browser to a URL with an upload form
- user selects a local file and clicks “upload” button on the form
- server accepts that file and places it in a specified place
I create an HTML file with a form that calls a php script when the submit button is clicked.
I’d like to change this to the following:
- From command line, user executes the following command:
“curl -X POST @somefile http://myhost/getter.php” - server (myhost) accepts that file and places it in a specified place
Said another way, I’d like to send the file directly to the php script without going through the form step.
Much thanks for any guidance.
http://curl.haxx.se/docs/httpscripting.html
4.3 File Upload POST
command line equivalent: