使用文件api服务器端代码拖放文件上传


drag drop file upload with file api server side code

我正在尝试使用file api进行拖放文件上传,并遵循本教程

https://developer.mozilla.org/en/Using_files_from_web_applications

它运行良好。当我看到带有firebug的ajax请求"POST"数据时,我看到了类似于的内容

--30000 Content-Disposition: form-data; name='fileId'; filename='header.jpg' Content-Type: application/octet-stream ÿØÿà �JFIF��H�H��ÿÛ�C�    $.' ",#(7),01444'9=82<.342ÿÛ�C  

如何在服务器端以图像格式保存这些数据??

您可以查看现场演示@http://www.amitpatil.me//demos/in_progress/gmail_fupload/file.html

您需要使用全局$_FILES。它包含有关上传数据的所有信息。看看http://www.php.net/manual/en/features.file-upload.post-method.php.在您的情况下,您将获得tmp。已使用$_FILES['fieldID']['tmp_name']上载文件。