2009-09-15 26 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

相關問題