1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[Solved] Trying to upload file with custom script but doesn't move/write

Discussion in 'XenForo Development Discussions' started by Aethelwulf, Jan 26, 2015.

  1. Aethelwulf

    Aethelwulf Member

    I'm using xenforo with nginx and thusfar it works perfectly with Xenforo by default image uploader. I'm running into problems though moving uploaded files from /tmp/ to /home/mysite/public_html/data/mycustomfolder/ with a custom script.

    The problem is the image doesn't show up in /tmp/ despite having full 777 chmod perms and ownership and full 777 perms at the destination folder with ownership.

    $image XenForo_Upload::getUploadedFile('uploadedImage');
    $image->isImage() && $image->isValid()){
    $source $image->getTempFile(); //.'/'.$image->getFileName();
    $destination "/home/mysite/public_html/data/mycustomfolder/imagetest.png";
    $success move_uploaded_file($source$destination);
    Does anyone have any suggestions? When I echo out the $source file it does show /tmp/cJ3jgj32/imagename.png but it is never actually in temp and thus it never copies to the destination.
    Last edited: Jan 26, 2015
    Kane Hart likes this.
  2. Aethelwulf

    Aethelwulf Member

    Solved it on my own, I've edited my original post to include the answer. The problem was that I was using getFileName() on top of getTempFile() but only getTempFile() was required as the source location.

Share This Page