0

Offline (locally) my images get trough after uploading, but online I can't. It's probably an easy fix for people that are experienced with PHP. The snippet below is for twitter, but the website is now on my hosting hosted so i dont have the directory 'twitter' anymore (since all the files are just pushed in another directory and not twitter)

Url hosting is: http://uptospace.thomasdebelder.be/ That's also where the files are in my ftp program: directory name: uptospace.thomasdebelder.be

move_uploaded_file($fileTmp,$_SERVER['DOCUMENT_ROOT'].'/twitter/'.$root);



if($fileSize <= 2097152) {
            $root = 'users/' . $filename;
            move_uploaded_file($fileTmp,$_SERVER['DOCUMENT_ROOT'].'/http://uptospace.thomasdebelder.be/home.php/'.$root);
            return $root;
           }

enter image description here

Thanks for your help

Distortion
  • 309
  • 2
  • 3
  • 12
  • Check permissions of the folder. – Troyer May 15 '18 at 10:12
  • 1
    `move_uploaded_file($fileTmp,$_SERVER['DOCUMENT_ROOT'].'/http://uptospace.thomasdebelder.be/home.php/'.$root);` ... ummmmm... that *should* be a filepath, not a mismash of filepath and URL. – CD001 May 15 '18 at 10:12
  • how to fix it? @CD001 – Distortion May 15 '18 at 10:12
  • There's a picture above with directory name @CD001 – Distortion May 15 '18 at 10:14
  • Depends on what your docroot is, I'm *guess* `$_SERVER['DOCUMENT_ROOT']` is *probably* something like `/var/www/uptospace.thomasdebelder.be/` ? (you can `var_dump()` it to check. – CD001 May 15 '18 at 10:14
  • Looking at that image - the document root is probably the `public_html` directory - all files would be served from there. If that's the case, the highlighted directory is *outside* the document root - so no files uploaded into that directory could be displayed in the browser, – CD001 May 15 '18 at 10:16
  • This might be useful: https://stackoverflow.com/questions/38509334/full-secure-image-upload-script – CD001 May 15 '18 at 10:49

0 Answers0