> > Bug (approved)

uploading files does not work

Summary

approved
Aug 31, 2006
100%
Sep 12, 2006
Aug 31, 2006 / pixtur
Jan 19, 2011 / guest
pixtur, madlyr
 

Attached files

Summary
errors.log.php
2795 bytes / ID 1816 / Sep 7, 2006
Show Details
file_upload_infofiles.zip
33218 bytes / ID 1819 / Sep 7, 2006
Show Details
 

Issue report

Minor
Have not tried
v0.0681
 

13 Comments

tino:Hey Tom,

11 years ago

I uploaded the requested files from madlyr.

You should see it - if not feel free to contact.


regards tino

By the way: madlyr wants to be a tester in streber - he will contact you soon.

pixtur:I don't see any uploaded files

11 years ago

So I guess it still doesn't work... ;-)

madlyr:debug output

11 years ago

Thomas - I added debug info

function filesUpload()
{
    global $PH;
 printFormVars();
    echo "<pre>";
    print_r($_FILES);
    echo "</pre>";

at the line 291 to pagesfile.inc.php
Output debug:

Array
(
    [search_query] =>
    [from] => 526a3edc3deb44611fa386822f011e8b
    [prj] => 32
    [go] => filesUpload
    [blockstyle_projViewChanges_changes] => grouped
    [blockstyle_projViewChanges_changes_grouping] => modified_by
    [STREBER_projViewTasks_preset] => open_tasks
    [NORD_UID] => 53bb038fe71a3ee0e522f2a3302589c4
)

Array
(
    [userfile] => Array
        (
            [name] => windows_update_bug.cmd
            [type] =>
            [tmp_name] =>
            [error] => 6
            [size] => 0
        )

)

Error 20060907120127 WARNING: renderrender_page.inc.php : 640 Cannot modify header information - headers already sent by (output started at /std/common.inc.php:155)
Error 20060907120127 renderrender_page.inc.php : 858 -> PageHtmlStart::__toString()
Error 20060907120127 pagesproj.inc.php :1227 -> PageHeader::__toString()
Error 20060907120127 stdclass_pagehandler.inc.php : 656 -> ProjViewFiles()
Error 20060907120127 stdclass_pagehandler.inc.php : 557 -> PageHandler::show("projViewFiles", [1])
Error 20060907120127 stdclass_pagehandler.inc.php : 708 -> PageHandler::showFromPage()
Error 20060907120127 pagesfile.inc.php : 298 -> PageHandler::abortWarning("Nothing uploaded")
Error 20060907120127 stdclass_pagehandler.inc.php : 656 -> filesUpload()
Error 20060907120127 index.php : 339 -> PageHandler::show("filesUpload")
Error 20060907120127
Error 20060907120127 Variables in __toString():
Error 20060907120127 v0.0681, projViewFiles, from 83.16.198.98, uri:/index.php
Error 20060907120127

I use versio 0,0681 - svn revision 74

madlyr:sysinfo and phpinfo attachment

11 years ago

I attach system and php info pages from my web server, php.ini and config.inc.php
More in topic: http://www.streber-pm.org/phpBB2/viewtopic.php?t=269
 
You may see, that this service is on the: IdeaWebServer/v0.40 webserver.
This Streber installation is account is on the biggest Polish web provider which has his own web server but it is reaaly very close to Apache and is stable.
We use file upload without any problems in Joomle and MAmbo CMS software but it is possible, that problem lies in webserfver software and subtle differences in use of upload functions.

pixtur:Oh well... Error-Code 6

11 years ago (2. update 11 years ago)

I am not php-wizard enough for the file uploading stuff. The important part of the debug-output is the error-code 6. As listed in http://www.php.net/manual/en/function.is-uploaded-file.php this error-code is not even defined. I am very very curious how joomla threats uploading differently.

I would love to fix streber on that point.


In your phpInfo-output note following line:

upload_tmp_dir	./:/_tmp:/_files:/teamwork/_tmp:/teamwork/_files	./:/_tmp:/_files:/teamwork/_tmp:/teamwork/_files

I do not know, what it does, but maybe you could ensure that this temporary directory is writeable...

tom

madlyr:attributes of directories

11 years ago

_tmp and _files directory had 755 attributes, after change directory attributes to 777 the same bahaviour...

pixtur:Sorry...

11 years ago

...but I currently have no clue on that one. I a quiet hour I could dive into the joomla code, and check how they implemented file uploading. But it may take some weeks, until I find some time :-(

tom

madlyr:I''l try to help to investigate this error.

11 years ago

  1. I find code in joomle and publish parts here
  2. I'll give you access to our streber (ftp and account)

madlyr:yeah my fault, setting temp directory was not correct

11 years ago

now it works!
at: http://www.php.net/manual/en/features.file-upload.errors.php
Error code 6 means:
UPLOAD_ERR_NO_TMP_DIR - Value: 6; Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3.

now my php.ini has upload_tmp_dir = "/_tmp"

madlyr:some suggested tweaks in code after problem research

11 years ago (2. update 11 years ago)

Here are some file upload code tweaks.

1) add after line 411 log debug code:

from db/class_file.inc.php

		switch ($_FILES[$upload_id]['error']) {
		   case UPLOAD_ERR_OK:
			   break;
		   case UPLOAD_ERR_INI_SIZE:
			   trigger_error("The uploaded file exceeds the upload_max_filesize directive (".ini_get("upload_max_filesize").") in php.ini.", E_USER_NOTICE);
			   break;
		   case UPLOAD_ERR_FORM_SIZE:
			   trigger_error("The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.", E_USER_NOTICE);
			   break;
		   case UPLOAD_ERR_PARTIAL:
			   trigger_error("The uploaded file was only partially uploaded.", E_USER_NOTICE);
			   break;
		   case UPLOAD_ERR_NO_FILE:
			   trigger_error("No file was uploaded.", E_USER_NOTICE);
			   break;
		   case UPLOAD_ERR_NO_TMP_DIR:
			   trigger_error("Missing a temporary folder.", E_USER_NOTICE);
			   break;
		   case UPLOAD_ERR_CANT_WRITE:
			   trigger_error("Failed to write file to disk", E_USER_NOTICE);
			   break;
		   default:
			   trigger_error("Unknown File Error", E_USER_NOTICE);
		}

2) replace line 203 with code:

from pages/file.inc.php

		echo '<input type="hidden" name="MAX_FILE_SIZE" value="'. confGet('FILE_UPLOAD_SIZE_MAX'). '" />';
		echo '<input id="userfile" name="userfile" type="file" size="40" accept="*" />';

3) replace line 1313 with code:

from pages/proj.inc.php

		echo '<input type="hidden" name="MAX_FILE_SIZE" value="'. confGet('FILE_UPLOAD_SIZE_MAX'). '" />';
		echo '<input id="userfile" name="userfile" type="file" size="40" accept="*" />';

4) replace lines 386-374 with code:

from pagers/task_view.inc.php

        $list->no_items_html= $list->summary=
          "<div style='text-align:left;'>".__('attach new'). ":<br> "
        .  "<input type=hidden name='parent_task' value='$task->id'>"
		.'<input type="hidden" name="MAX_FILE_SIZE" value="'. confGet('FILE_UPLOAD_SIZE_MAX'). '" />'
		.'<input value="-" id="userfile" name="userfile" type="file" size="40" accept="*" />'
        . '<input class=button  type="button" value="' .__('Upload') ."" onclick='document.my_form.go.value="filesUpload";document.my_form.submit();'/>"
        . '</div>'
        ;

Points 2-4 add hidden form field MAX_FILE_SIZE as stated in php documentation.

pixtur:Hi Madlyr,

11 years ago

Do you have svn-access? If not please get an sourceforge account, so I can grant you write access. The changes look like you know what you are doing. If you would commit them directly this would be much quicker.

tom

madlyr:Yes I have sf account -> madlyr

11 years ago

My SF account id madlyr.
It would be much easier and quicker, if I can do some updates directly. Probably small, minor bug fixes or language version -> I try to translate streber to polish version (due my lack of time ot could take some time).

Radek

madlyr:code tweaks commited

11 years ago