Failed to Upload file error and it came all of a sudden
Submitted by Legend on Sun, 08/10/2008 - 17:05.
Hi,
I was trying to upload a new file today and all of a sudden, I get this error "Failed to Upload file". I have tried all the solutions posted here in the forum but for some reason it doesn't work.
I tried patching the files.php with the one provided here
I tried reinstalling projectpier but this did not help either
Any solution is appreciated.
Thank You,
Rahul

Open config/config.php and enable debug by changing
define('DEBUG', false);
to:
define('DEBUG', true);
That *should* give us some more information to play with
Hi,
Thank for your response. I am sorry but that is another problem I've been trying to overcome for the last few hours. For some strange reason, even when I set debug to true, it does not give me any more information. Following is the screenshot of the actual problem:
http://www.hashingintelligence.com/sandbox/problem.png
What is even more strange is, even when I set the File storage to MySQL Database, it gives me the same problem. I can't think of any other solution as of now. Do you suggest any other resort please?
Have you been able to upload files before, using either pp or another cms?
This sounds like it is probably related to a change made by your hosting provider. First I would check with them about any recent updates, specifically related to apache conf, php.ini, php run environment or some permissions.
Depending on their answer, I would also ask them to help you debug this problem since it will almost invariably be something you need their help to change on your local site.
The fact that the debug setting isn't working suggests to me that there are changes in the php env.
I checked the code and it appears that the 'Failed to upload file' error is only displayed if:
a) Some required data is not provided. As you have already reinstalled pp once, we can assume this is not the problem
b) The directory where the file was uploaded to is not readable. This would be an issue which only your host can resolve
c) Has an error status greater than UPLOAD_ERR_OK (http://uk2.php.net/manual/en/features.file-upload.errors.php). Again, these errors are to do with the way your host have configured your server.
Alex
@Ryan, it appears that the InvalidUploadError exception is not localised
First of all, I am sorry for raising the problem but at least we now know the problem. It seems that the temp folder was not set properly in the php.ini file. I asked my host if there was a problem with the open_basedir restriction and that is when the temp folder was found to be null. The host changed it and now things are working.
There was a logical way of arriving at the problem too:
When the file storage was changed to MySQL and the problem persisted, I should've thought that there was a problem at the upload level but instead I went ahead and reinstalled things.
Just in case, I think the variable in php.ini was upload_tmp_dir.
One last thing that is left is why setting debug does not produce any output in the frontend. Is it that it gives me something only when an error is present?
Thank You
I would have to dig through the code (and the problem) to be 100% sure, but basically all the debug setting does is allow the native PHP errors to come through. It sounds like this problem would not produce any extra php errors, therefore wouldn't have trigged any extra notices.
@Alex - care to make an issue/patch about the localization issue?
So, I found one error when I enabled the debug variable in the config file. Basically, I enabled it and started clicking just about everything and performing just about every action like posting messages, creating projects etc.
So when I have the debug variable enabled, I get the following error when I try to post a reply to a comment:
Notice: Undefined variable: recipients in /home/hashingi/public_html/sandbox/application/models/notifier/Notifier.class.php on line 139Warning: Cannot modify header information - headers already sent by (output started at /home/hashingi/public_html/sandbox/application/models/notifier/Notifier.class.php:139) in /home/hashingi/public_html/sandbox/environment/functions/general.php on line 323
If debug is disabled, of course, the above error is not being displayed so you were right about debug enabling/disabling php error reporting.
I am pretty sure that is a known bug, upgrade to 0.8.0.3 and it should fix it.