[英]receive image with PHP sent from FLASH
How can I save image with PHP which was uploaded with http post using FLASH?如何使用 FLASH 上传 http 帖子的 PHP 保存图像?
To upload to i'm PHP using this:上传到我 PHP 使用这个:
var upload_to:*=new flash.net.URLRequest("url");
fileHandler.upload(upload_to);
And when I print $_FILES in PHP I get:当我在 PHP 中打印 $_FILES 时,我得到:
{"Filedata":{"name":"IMG_8658 copy44.jpg","type":"application\/octet- stream","tmp_name":"C:\\WINDOWS\\Temp\\php35.tmp","error":0,"size":183174}}
so the question is, how to form a file from that $_FILES variable?: ) Thanks所以问题是,如何从那个 $_FILES 变量形成一个文件?:) 谢谢
PHP doesn't store the file in memory. PHP 不将文件存储在 memory 中。 It's written out to a temporary file, which you can retrieve the name/path of from the tmp_name
value (C:\WINDOWS...).它被写入一个临时文件,您可以从tmp_name
值 (C:\WINDOWS...) 中检索其名称/路径。 The name
field is the filename as provided by the client (IMG_8658...); name
字段是客户端提供的文件名(IMG_8658...);
In your case, that'd be在你的情况下,那是
$_FILES['Filedata']['tmp_name'] <-- location of temporary file
$_FILES['Filedata']['name'] <---original filename
$_FILES['Filedata']['size'] <--- size in bytes
$_FILES['Filedata']['type'] <-- mime type, as provided by the uploader
$_FILES['Filedata']['error'] <--- error code of upload operation (0 = a-ok)
use copy($_FILES['Filedata']['tmp_name'],'your destination path');
使用copy($_FILES['Filedata']['tmp_name'],'your destination path');
function. function。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.