Problems when hosting

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tito85
Forum Contributor
Posts: 104
Joined: Sat Mar 13, 2010 11:26 am

Problems when hosting

Post 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";
                  }
              }
mikosiko
Forum Regular
Posts: 757
Joined: Wed Jan 13, 2010 7:22 pm

Re: Problems when hosting

Post 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"
tito85
Forum Contributor
Posts: 104
Joined: Sat Mar 13, 2010 11:26 am

Re: Problems when hosting

Post 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...
mikosiko
Forum Regular
Posts: 757
Joined: Wed Jan 13, 2010 7:22 pm

Re: Problems when hosting

Post 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 ?
Post Reply