简体   繁体   English

PHP:重新处理上传的文件

[英]PHP: ReSTful handling of Uploaded files

I'm currently creating a web service that receives files(images) and some other data. 我目前正在创建一个接收文件(图像)和其他一些数据的Web服务。

The problem is how can PHP 'handle' it? 问题是PHP如何“处理”它? I've read some articles saying i should use PUT method. 我读过一些文章说我应该使用PUT方法。 How do you read it? 你怎么看的? http://input ? http://输入 POST? POST? FILES? 文件?

From Reference 来自Reference

<?php
/* PUT data comes in on the stdin stream */
$putdata = fopen("php://input", "r");

/* Open a file for writing */
$fp = fopen("myputfile.ext", "w");

/* Read the data 1 KB at a time
   and write to the file */
while ($data = fread($putdata, 1024))
  fwrite($fp, $data);

/* Close the streams */
fclose($fp);
fclose($putdata);
?>

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

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