Search code examples
javascriptphpresumablejs

PHP @move_uploaded_file returning false with Resumable.js


I am trying to implement Resumable.js with a PHP backend, and am using the sample backend provided: Sample Backend

I make the call from my javascript page via:

var r = new Resumable({
        target:'backend.php',
        chunkSize:1*1024*1024,
        simultaneousUploads:4,
        testChunks:false,
        throttleProgressCallbacks:1
      });

However, it seems to log this error when it reaches this line in the PHP file

if (!@move_uploaded_file($file['tmp_name'], $dest_file)) {
    _log('Error saving (move_uploaded_file) chunk '.$_POST['resumableChunkNumber'].' for file '.$_POST['resumableFilename'].'tmp_name: '.$file['tmp_name']);

This is the log

16.01.2013: Error saving (move_uploaded_file) chunk 1 for file Invoice-2010-04-30.xls tmp_name/tmp/phpqggZ0O

Is there a specific reason why? The PHP I'm using is the exact one taken from the link above.


Solution

  • I fixed this issue by modifying the directories that the PHP file uses. A lot of times it would use incorrect, or just out of place directories. Once that was fixed, it was working fine.