• 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

#1
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.


PHP:
$image = XenForo_Upload::getUploadedFile('uploadedImage');
if($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:
#2
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.