Upload File Problem

Tagged:  

I have this problem when i upload file

Failed to create folder '/home/buce2647/public_html/projectpier/upload/f6c33/c917b/6e3b8'

Can anybody help me fix it? Thank !

Ensure the file permission on the directory /home/buce2647/public_html/projectpier/upload/ is set to 777. This should have been done before installation (the installer requires it), but perhaps someone has changed it.

The permission of that folder is still 777.

What extension has the archive?
What size has the archive?

i tried pdf, rar and docx file.
the size of those file is from 400kb->1.6M. But all times i got that problem

ls -la upload
chmod 777 upload
What limit has "max_file_size" in your php.ini?

the max_file_size is 2M
permission of upload folder is 777. I set it when i installed pp.

I had the same issue in php 5.3.3 on a one.com site.

All directories were 777. But no luck.
As pointed out by Nieuwenhuis below the problem is force_mkdir in files.php.

In the code the explode function gives back an empty string as first element because the path starts with a /. This is not expected by the code that follows.

If you have PHP 5+ the solution is simple, add this line:

return mkdir($path, $chmod, true);

after:

function force_mkdir($path, $chmod = null) {

in environment/functions/files.php. That worked for me.

If you have PHP less than 5, add this line:

if ($real_path[0]=='/') $real_path=substr($real_path,1);

after:

$real_path = str_replace('\\', '/', $path);

in environment/functions/files.php. But this last solution did not work for me. Problem is that the half of the real path is outside my site root. As such, the is_dir function fails in PHP and the code assumes the directory needs to be created. That needs more work to fix. I hope you have PHP 5+.

Debug details for initial problem

===outside www root for my site=========/
/customers/mysite.nl/mysite.nl/httpd.www/projectpier-0.8.0.3/upload/f945c/a540a/65137

array(10) { [0]=> string(0) "" [1]=> string(9) "customers" [2]=> string(10) "mysite.nl" [3]=> string(10) "mysite.nl" [4]=> string(9) "httpd.www" [5]=> string(19) "projectpier-0.8.0.3" [6]=> string(6) "upload" [7]=> string(5) "f945c" [8]=> string(5) "a540a" [9]=> string(5) "65137" }

forced_path=/

I have the same issue. Note that the error reads that it can't create the FOLDER to place the file in. The 'upload' folder is there, permissions are 777, but I get the error:

Failed to create folder '/var/www/vhosts/downtownbaraboo.com/subdomains/members/httpdocs/upload/a367c/0e023/3a2c6'

..when I try to upload a small test file and/or photo. Interestingly, I was able to upload avatars and company logos. Those images get stored in '/public/files' which also has 777 permissions, but no sub-folder are created.

Finally, the files/folders uploaded through FTP are owned by a non-system user and group, but uploaded files and folders are owned by apache.apache . Is it possible that apache's umask or something along those lines is the problem?

I played around with this some more. The problem is with the "force_mkdir" function in 'envrionment/functions/files.php' (line 231). I ended up changing it a bit and got it to work. mkdir() in PHP5 has a recursive flag that does what force_mkdir() seems to want to do.

Also, in my /upload folder I had a file called 'attributes.php'. This also needed to be writable in order for file uploads to work.

I have the same problem as above - I get a failed to create folder error when I try to upload a file. Looking through the forum, it sounds like this has been an ongoing problem for years. Is there a stable fix? If not, I'll be moving on to another product. Looks like a great tool, but I don't have a web admin and can't afford the time it seems to take to get this tool to work.

Thanks.
Elsbeth

Solution for file based storage here:

http://www.projectpier.org/node/1856

Works for PHP4 and 5.

Configuration→General→change file storage to Database (MYSQL)→upload attach should work