Author Topic: [SOLVED] Failed to upload file, opengoo 1.6  (Read 3190 times)

ashok

  • Newbie
  • *
  • Posts: 2
    • View Profile
[SOLVED] Failed to upload file, opengoo 1.6
« on: 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
« Last Edit: December 13, 2009, 08:08:07 pm by ashok »

ashok

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: file upload failed
« Reply #1 on: 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.

tfrasch

  • Guest
Re: Failed to upload file, opengoo 1.6
« Reply #2 on: 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:
Code: [Select]
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:
Code: [Select]
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

Regards
Tobias
« Last Edit: December 15, 2009, 02:14:19 pm by tfrasch »

milars84

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Re: [SOLVED] Failed to upload file, opengoo 1.6
« Reply #3 on: December 17, 2009, 07:19:51 am »
thanks for this problem solving