php - AWS Elastic Beanstalk file upload not working -


we use aws elastic beanstalk host php applications include file upload facilities aren't working. have php.ini set tmp_upload_dir /tmp still doesn't work.

we've moved site server, working there, eb doesn't seem want let upload files.

here's example of code using:

$imagepath = "/tmp/";  $allowedexts = array("gif", "jpeg", "jpg", "png", "gif", "jpeg", "jpg", "png"); $temp = explode(".", $_files["img"]["name"]); $extension = end($temp);  if ( in_array($extension, $allowedexts))   {   if ($_files["img"]["error"] > 0)     {          $response = array(             "status" => 'error',             "message" => 'error return code: '. $_files["img"]["error"],         );         echo "return code: " . $_files["img"]["error"] . "<br>";     }   else     {        $filename = $_files["img"]["tmp_name"];       list($width, $height) = getimagesize( $filename );        move_uploaded_file($filename, $imagepath . $_files["img"]["name"]);        $response = array(         "status" => 'success',         "url" => $imagepath.$_files["img"]["name"],         "width" => $width,         "height" => $height       );      }   } else   {    $response = array(         "status" => 'error',         "message" => 'something went wrong',     );   } 

i had same problem, , found needed 2 things, both of put .htaccess file:

 php_value upload_tmp_dir "/tmp"  php_value upload_max_filesize 10m 

the upload directory must owned web server, e.g. "webapp", or "daemon", or writable account. in addition, max filesize must accommodate uploads.

in case, upload limit 2m default, , files 4m. resulted in empty $_files array.


Comments

Post a Comment

Popular posts from this blog

java - Unable to make sub reports with Jasper -

scala - play framework: Modules were resolved with conflicting cross-version suffixes -

Passing Variables from AngelScript to C++ -