0

So the problem is, move_uploaded_file works perfectly in local machine and I can delete also image by delete command but when I moved this to host and try to upload some image there, it doesn't move to the folder or delete images in the host. folders have 755 permission and I don't understand what to do.

riverhorse
  • 131
  • 9
  • Have you enabled error_reporting to see if you get any errors that might be helpful? [How do I get PHP errors to display?](https://stackoverflow.com/questions/1053424/how-do-i-get-php-errors-to-display?rq=1) – brombeer Jul 26 '20 at 10:16

1 Answers1

1

A possible problem is that you don't have permission to write into the target directory!!

Please check if you are able to with your provider. You may have to set FTP permissions 777 to upload directory or to choose a different upload path that is given by your ISP.

At least that is the most typical issue.

MD. Jubair Mizan
  • 1,467
  • 1
  • 9
  • 18
  • I used $_SERVER['DOCUMENT_ROOT'] for SITE_ROOT and now it works but for example, when I use this for IMAGE_PATH to show images it doesn't work or $_SERVER['HTTP_HOST'] but when I write for image path like this www.123.com it works any idea why? – riverhorse Jul 26 '20 at 10:33
  • 1
    Try $_SERVER['SERVER_NAME'] instead of using $_SERVER['HTTP_HOST'] – MD. Jubair Mizan Jul 26 '20 at 10:38