简体   繁体   English

HTTP PUT一个文件

[英]HTTP PUT a file

Does anyone have code of a simple web browser file/script (HTML/javascript/whatever) that can upload a user selected file to a server using HTTP PUT? 是否有人拥有简单的网络浏览器文件/脚本(HTML / javascript /其他)代码,可以使用HTTP PUT将用户选择的文件上传到服务器?

Everything I keep reading says that browsers do support HTTP put, but just not through any scripting?! 我一直在阅读的内容都表明浏览器确实支持HTTP put,但是只是不通过任何脚本执行?!

What is the most common way to upload a file then? 那么,最常见的上传文件的方式是什么? Using post?? 使用帖子?

It's normally a POST, using a form with a special attribute: enctype="multipart/form-data" 通常是POST,使用具有特殊属性的表单:enctype =“ multipart / form-data”

You'll need a server-side technology to accept the file and then do something with it. 您将需要服务器端技术来接受文件,然后对其进行处理。

I guess plain old PHP is a cheap and easy way to achieve this, but I guess you probably have an existing website or something which you're trying to work with, right? 我想普通的旧PHP是实现此目标的一种廉价且简便的方法,但是我想您可能已经拥有一个现有网站或您想要使用的网站,对吗?

Here's a php tutorial, (there's millions out there): http://www.tizag.com/phpT/fileupload.php 这是一个php教程,(那里有数百万个): http : //www.tizag.com/phpT/fileupload.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM