PHP's file upload is failing on server -


i developing website includes functions file upload. working on localhost, once uploaded site server fails.

i have following code handle file upload:

case "upload_to_gallery":          /*******************************          ****   upload gallery   ****          *******************************/          if ($con->checklogin() && isset($_files['uploaded_files'])) {             $gallery_name = $_post['gallery_name'];              ($i = 0; $i < count($_files['uploaded_files']['name']); $i++) {                 list($width, $height, $type, $attr) = getimagesize($_files["uploaded_files"]['tmp_name'][$i]);                  if ($_files['uploaded_files']['type'][$i] == "image/png"                     || $_files['uploaded_files']['type'][$i] == "image/jpeg"                     || $_files['uploaded_files']['type'][$i] == "image/gif"                 ) {                     $imgpath = "../files/img/galleries/" . $gallery_name . "/" . $_files['uploaded_files']['name'][$i];                     $thumbpath = "../files/img/galleries/" . $gallery_name . "/thumbs/" . $_files['uploaded_files']['name'][$i];                      move_uploaded_file($_files['uploaded_files']['tmp_name'][$i], strtolower($imgpath));                      $filehandler->makethumbnails($imgpath, $thumbpath, 300, 215);                 }              }             header('location: '.mainpath.'/galleri/'.$gallery_name.'?billeder_uploadet'); 

and errors getting, when trying upload files (images) on server is:

warning: move_uploaded_file(../files/img/galleries/test/1383204_10200900060289437_410542691_n.jpg) [function.move-uploaded-file]: failed open stream: no such file or directory in /var/www/xn--cstanlg-rxa.dk/public_html/web/templates/formreceiverpost.php on line 35

warning: move_uploaded_file() [function.move-uploaded-file]: unable move '/tmp/phptu17hf' '../files/img/galleries/test/1383204_10200900060289437_410542691_n.jpg' in /var/www/xn--cstanlg-rxa.dk/public_html/web/templates/formreceiverpost.php on line 35

warning: getimagesize(../files/img/galleries/test/1383204_10200900060289437_410542691_n.jpg) [function.getimagesize]: failed open stream: no such file or directory in /var/www/xn--cstanlg-rxa.dk/public_html/lib/class/filehandler.php on line 158

warning: division 0 in /var/www/xn--cstanlg-rxa.dk/public_html/lib/class/filehandler.php on line 159

warning: division 0 in /var/www/xn--cstanlg-rxa.dk/public_html/lib/class/filehandler.php on line 159

warning: imagecreatetruecolor() [function.imagecreatetruecolor]: invalid image dimensions in /var/www/xn--cstanlg-rxa.dk/public_html/lib/class/filehandler.php on line 162

when try upload 0 files server gives me error:

warning: getimagesize() [function.getimagesize]: filename cannot empty in /var/www/xn--cstanlg-rxa.dk/public_html/web/templates/formreceiverpost.php on line 26

which don't think makes sense, checking if files has been sent through..

i thought might have permissions on server, relevant folders set '755'.

i hope might know problem be. appreciated.

check errors.

warning: move_uploaded_file(../files/img/galleries/test/1383204_10200900060289437_410542691_n.jpg) [function.move-uploaded-file]: failed open stream: no such file or directory in /var/www/xn--cstanlg-rxa.dk/public_html/web/templates/formreceiverpost.php on line 35

warning: move_uploaded_file() [function.move-uploaded-file]: unable move '/tmp/phptu17hf' '../files/img/galleries/test/1383204_10200900060289437_410542691_n.jpg' in /var/www/xn--cstanlg-rxa.dk/public_html/web/templates/formreceiverpost.php on line 35

warning: getimagesize(../files/img/galleries/test/1383204_10200900060289437_410542691_n.jpg) [function.getimagesize]: failed open stream: no such file or directory in /var/www/xn--cstanlg-rxa.dk/public_html/lib/class/filehandler.php on line 158

you have both test , test in paths.

remember linux case-sensitive file , folder names. windows not. might explain why worked on dev environment , why didn't anymore on prod server.

so pick either 1 of them , stick (i wouldn't recommend use uppercase characters in paths though).


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -