Search code examples
phpjqueryhtmluploadplupload

How to figure out why plupload and upload.php is creating the upload folder, but not placing files?


I've read through a number of posts of other people having issues with plupload, or trying to extend it's functionality. I'm attempting to set up a plupload panel on my website. Whether I'm working with my home server or on my public site, the form comes up, although it's kind of goofy. I can select images to upload, or drag them into the panel (html5). When I click on Start Upload, it goes through the process of uploading the files. If the upload folder is not there, the php script creates it, so I know there is at least some interaction, but no files get placed in the folder.

I added a bit to the php file to write to a text file to determine what it's getting for the filename and in every test, I get a single line of text, no matter how many files and no matter what they're named:

p16kp2h79g1hf1kidaivehb68r1a.png

I'm using the default upload.php in the examples folder and the only modifications I've made is to change the name of the upload folder to TempUploads, and add four lines as seen below:

$fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : '';
     $myFile = "testFile.txt";
     $fh = fopen($myFile,'w') or die("can't open file");
     fwrite($fh,$fileName);
     fclose($fh);
// Clean the fileName for security reasons
$fileName = preg_replace('/[^\w\._]+/', '_', $fileName);

If you need to see it, www.battletech-live.net, then click on the first icon in the upper-right bar. Then press the letter u on the keyboard. Then hit escape twice and do it again. There's a creation sequence issue that I'll have to sort out another time.


Solution

  • Its most definitely due to the fact that the created folders have permissions set that prevent upload.php to write a file in them.