Feng Forum

Support => Older versions => : ashok December 13, 2009, 08:00:28 PM

: [SOLVED] Failed to upload file, opengoo 1.6
: ashok December 13, 2009, 08:00:28 PM
Opengoo 1.6, apache 2.2.14, php 5.2.11, mysql 5.0.75

While uploading a new file in Documents, get error: Failed to upload file. Tried in firefox and IE. Tried uploading file less than 2 mb (xls and txt).

Log reads:
Session "default" started at 2009-12-13T22:59:03+0000

#1 ERROR: Error: copy(/usr/home/webalgo/public_html/office/tmp/og_1260744749_637205) [<a href='function.copy'>function.copy</a>]: failed to open stream: No such file or directory in '/usr/home/webalgo/public_html/office/application/controllers/FilesController.class.php' on line 480 (error code: 2)

Time since start: 0.081419944763184 seconds
: Re: file upload failed
: ashok December 13, 2009, 08:06:52 PM
Upgraded to 1.6 using autoupgrade in admin panel.
The tmp folder was missing. Uploaded manually the tmp folder from previous local version. Everything works now.
: Re: Failed to upload file, opengoo 1.6
: tfrasch December 15, 2009, 01:48:25 PM
This problem can't be solved by recreating the tmp folder, as it gets deleted again while cleaning the tmp folder through the cron script. This problem causes also other modules which rely on the tmp folder to malfunction.

I tracked the error down: In function clear_tmp_folder in /application/cron_functions.php it reads in line 103:
:
if ($count == 0) @rmdir($dir);
Let's suppose /tmp is empty then $count will not be initialized. Though the condition above throws a warning, it is still true. At least in Debian's PHP 5.2.6-1+lenny4.

So to solve this issue, simply use a strict comparison:
:
if ($count === 0) @rmdir($dir);
In a loose comparison 0 and NULL are "the same". For more information see http://us2.php.net/manual/de/types.comparisons.php (http://us2.php.net/manual/de/types.comparisons.php)

Regards
Tobias
: Re: [SOLVED] Failed to upload file, opengoo 1.6
: milars84 December 17, 2009, 07:19:51 AM
thanks for this problem solving