Page 1 of 1

Problems when hosting

Posted: Thu May 13, 2010 7:58 am
by tito85
Hi All,

I'm using this code to edit movie image. this should upload the image to the Images/Movie/ folder however it is not woking. The filename is being updated in the database but the image is found no where.

I tested this site on my wamp server and it is working. When hosting online it is not.

Any Help please?

Code: Select all

if (strlen($image['name']) > 0) {
                  //checking if image is JPG
                  if ($image['type'] == "image/jpeg" || $image['type'] == "image/pjpeg") {
                      $filename = $image['name'];
                      //uploading the file
                      move_uploaded_file($image['tmp_name'], "Images/Movies/" . $image['name']);
                      //remove old image
                      if (strlen($currentimage) > 0)
                          unlink("Images/Movies/" . $currentimage);
                  } else {
                      $message = "Only .jpg images are allowed to be uploaded";
                  }
              }

Re: Problems when hosting

Posted: Thu May 13, 2010 10:30 am
by mikosiko
I can think in 3 possible reasons:

a) You don't have the right access for the folders "Images/Movies"
b) You are using the wrong path for the folders
c) In your host the folders names are not "Images/Movies"... maybe the name are "images/movies"

Re: Problems when hosting

Posted: Thu May 13, 2010 10:41 am
by tito85
Hi

Just to answer you points;

a) Regarding the right access I'm not sure to be honest and I don't even know how to check
b) The path folders are good
c) Forder Images path is Images/Movies

Locally everything is working fine...

Re: Problems when hosting

Posted: Thu May 13, 2010 10:47 am
by mikosiko
according to the move_upload_files() possible return values:

[text]"Return Values

If filename is not a valid upload file, then no action will occur, and move_uploaded_file() will return FALSE.

If filename is a valid upload file, but cannot be moved for some reason, no action will occur, and move_uploaded_file() will return FALSE. Additionally, a warning will be issued."[/text]

are you getting any warning/error message ?