Sunday, 11 August 2013

uploading files with curl and report http error

uploading files with curl and report http error

Helo,
I have made a simple page with html which has a button for choosing a file
from my pc and enables to upload it.
<div>
<input type="submit" name="my_file" id="my-file"></input>
</div>
I want it to be able to upload a special file and in case the user upload
a wrong file it will report http error (402). I have done it with curl
post, like this:
curl -i -F file=@my.license
According to:http://ariejan.net/2010/06/07/uploading-files-with-curl/ So
here the uploaded file will be posted to the backend and if the file was
ok it will be uploaded otherwise it sends the error.Now my question is
that how can I produce this 402 http error from backend? Is it something
server side that runs automaticall or I should make this error activated
when the file is not correct?
Thank you,

No comments:

Post a Comment