Note that there are some explanatory texts on larger screens.

plurals
  1. POHelp with uploading images to EC2 instance (Flash -> PHP)
    text
    copied!<p>I have developed an image uploading application that uses Flash to load an image, resize the image and send the bytearray of the image data to a PHP file that outputs the resized file using the following code -</p> <pre><code>$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"; } </code></pre> <p>This worked great when I was running it from a dedicated windows 2003 web server but now that I am trying to run this on an EC2 instance it has stopped working and I only get the "File Upload Failed" message. I can tell from Firefox's Firebug add-on that the bytearray data is being posted to the EC2 instance ok but cannot see what else would be causing the problem.</p> <p>on EC2 I am running a CentOS image with PHP and Apache installed, I dont event know where to start troubleshooting this one! Please tell me what issues i need to be looking for here, any ideas?</p> <p>I checked the error logs and get the following error message - </p> <pre><code>file_put_contents(/uploads/temp/abcdefg.JPG) [&lt;a href='function.file-put-contents'&gt;function.file-put-contents&lt;/a&gt;]: failed to open stream: No such file or directory </code></pre> <p>Is this to do with pointint to the wrong directory? or permissions as someone has stated below? How do I give PHP permission to write to this directory and should I use absolute path to reference the directory I want to write the image to?</p> <p>cheers </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload