Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/292.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
帮助将图像上载到EC2实例(Flash->;PHP)_Php_Flash_Amazon Ec2_Bytearray - Fatal编程技术网

帮助将图像上载到EC2实例(Flash->;PHP)

帮助将图像上载到EC2实例(Flash->;PHP),php,flash,amazon-ec2,bytearray,Php,Flash,Amazon Ec2,Bytearray,我开发了一个图像上传应用程序,它使用Flash加载图像,调整图像大小,并将图像数据的字节数组发送到PHP文件,该文件使用以下代码输出调整大小的文件- $default_path = '/uploads/temp/'; $filename = $_GET["filename"]; $destination = $default_path . $filename; if(file_put_contents($destination, $GLOBALS["HTTP_RAW_POST_DATA"]))

我开发了一个图像上传应用程序,它使用Flash加载图像,调整图像大小,并将图像数据的字节数组发送到PHP文件,该文件使用以下代码输出调整大小的文件-

$default_path = '/uploads/temp/';
$filename = $_GET["filename"];
$destination = $default_path . $filename;
if(file_put_contents($destination, $GLOBALS["HTTP_RAW_POST_DATA"])) {
echo "The file " . basename( $_FILES[ 'Filedata' ][ 'name' ] ) . " has been uploaded;";
} else {
   echo "FILE UPLOAD FAILED";
}
当我在专用的Windows2003Web服务器上运行它时,它工作得很好,但现在我尝试在EC2实例上运行它,它已停止工作,我只收到“文件上载失败”消息。我可以从Firefox的Firebug插件中看出,bytearray数据正在发布到EC2实例,但看不出还有什么会导致问题

在EC2上,我正在运行一个安装了PHP和Apache的CentOS映像,我不知道从哪里开始解决这个问题!请告诉我我需要在这里寻找什么问题,有什么想法吗

我检查了错误日志并得到以下错误消息-

file_put_contents(/uploads/temp/abcdefg.JPG) [<a href='function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: No such file or directory
file\u put\u contents(/uploads/temp/abcdefg.JPG)[]:无法打开流:没有这样的文件或目录
这与指向错误目录的pointint有关吗?或者某人在下面陈述的权限?如何授予PHP写入此目录的权限,以及是否应使用绝对路径引用要将图像写入的目录


干杯

我不知道您是否愿意使用其他类,但是有一些PHP EC2类可能会有所帮助-

可能是权限问题,可能PHP用户没有权限写入指定目录


apache错误日志中是否有任何消息?

如何检查?我不明白你说的PHP用户是什么意思?我如何知道该PHP用户拥有哪些权限以及如何更改这些权限?请参阅我对另一个问题的回答(以避免重新键入所有内容…):