2009-09-15 27 views
1

我面临着将快照上传到服务器的任务。但我不希望用户将图像下载到他们的计算机上。如何使用AS3将SWF的快照保存到服务器?

我已经探索产生与PHP的图像服务器端的几个解决方案,但他们似乎都使用在服务器发送图像给用户的方法。

见例如:http://mattkenefick.com/blog/2008/11/06/saving-jpegs-with-flash/

我不知道是否有可能节省$ GLOBALS [“HTTP_RAW_POST_DATA”],这在例如包含由Flash发送到服务器作为图像文件的ByteArray .. ..

+1

内容,我发现这个计划似乎非常有帮助:http://labs.findsubstance.com/2008/10/24/updated-using-as3-to-upload-and-encode-images/ – picardo 2009-09-15 22:54:11

回答

4

使用PHP代码,沿着这些线路,以节省的$GLOBALS["HTTP_RAW_POST_DATA"]

 // untested code 

     $imageBytes = $GLOBALS["HTTP_RAW_POST_DATA"] 
     // in real code you better create a new file for every upload :-) 
     $file = fopen("uploads/test.jpg", "w"); 
     if(!fwrite($file, $imageBytes)){ 
      return "Error writing to file: $file"; 
     } 
     fclose($file); 
+0

这很好。谢谢。 – picardo 2009-09-15 22:52:52

相关问题