I want to send a file in a REST PUT request. The user should be able to choose the file he wan开发者_如何学Pythonts to load from his local machine. I need to load the file as binary content and send it as part of the PUT request.
How can i let the user choose the file and load its binary content?
You should have a form with the enctype of multipart/form-data and the method equals PUT
<form method="PUT" enctype="multipart/form-data" action="http://myrestserver.com/">
User name: <input type="text" name="username" />
<br />
Password: <input type="password" name="password" />
<br />
File to upload: <input type="file" name="uploaded_file">
<br />
<input type="submit" value="Press"> to upload the file!
</form>
精彩评论