DOCman 1.4 RC3: Error Uploading. Directory Problem. *FIX*

I have verified that this fix works, and that it is, in fact, a bug in the latest release.

EDIT: (8.11.08) Please make sure you change the quotes once you copy in the code.  Wordpress will alter them, so you need to copy the code into your files and then delete each quote and retype it.  It should clear a lot of the PHP errors everyone’s getting, since it doesn’t know how to handle them, and is resulting in unpredictable behavior.

EDIT: (8.27.08) The paths to the files are as follows:

JOOMLA/components/com_docman/includes_frontend/upload.http.php
JOOMLA/administrator/components/com_docman/includes/files.php
JOOMLA/administrator/components/com_docman/classes/DOCMAN_file.class.php

Where JOOMLA is the root / home folder of the joomla installation (not to be confused with the root folder of the server).


Hello I’ve had the error message “error uploading. directory problem” with DOCman 1.4 RC3, debugged the code and found the solution - it is a bug in RC3:Effect:
- Error message: “error uploading. directory problem”, after step 2 of uploading a new file,Occurrence:
- with docman 1.4 RC3, (not with RC1)
- on windows-based webservers (directory paths with backslash)
- if in PHP configuration “magic_quotes_gpc” is set to “on”

Reason:
Bug in RC3:
“DOCMAN_Utils::stripslashes()” removes backslashes in [’tmp_name’], what should NOT be done!!
- in “com_docman/includes_frontend/upload.http.php”, Line 38
- in “com_docman/includes/files.php”, Line 177:

Solution:
In “com_docman/includes/files.php”, line 177
remove DOCMAN_Utils::stripslashes() function:
- incorrect: $file_upload = mosGetParam(DOCMAN_Utils::stripslashes($_FILES), ‘upload’);
- correct: $file_upload = mosGetParam($_FILES, ‘upload’);

In “com_docman/includes_frontend/upload.http.php”, line 38
remove DOCMAN_Utils::stripslashes() function:
- incorrect: $file = mosGetParam(DOCMAN_Utils::stripslashes($_FILES), ‘upload’);
- correct: $file = mosGetParam($_FILES, ‘upload’);

And instead: In “com_docman/classes/DOCMAN_file.class.php”, line 352
add DOCMAN_Utils::stripslashes() function:
- incorrect: $name = $file[’name’];
- correct: $name = DOCMAN_Utils::stripslashes($file[’name’]);

For more information on [’tmp_name’] and backslashes
- see http://ch2.php.net/features.file-upload#42280 (11-May-2004 03:08)

That worked for me. :geek:

Good luck!
Benno

17 Responses to “DOCman 1.4 RC3: Error Uploading. Directory Problem. *FIX*”

  1. basjoomla Says:

    Thks Great fix (Y)(Y)

    BTW www.ouagaguide.com is not done with joomla but oldscool code :D

  2. Ramón Says:

    Don’t work for me.
    I did all you say step to step and now i have a new error: A filename is required

  3. Steve Hernandez Says:

    I would make sure you have the proper permissions on your folders (That’s the first thing they tell you to look at).

    I’ve upgraded 3 other sites (4 in total) and the fix works.

    Sorry it didn’t work.

  4. Hynnot Says:

    Thanks but now I have this error:

    A filename is required.

    :(

  5. Hynnot Says:

    Yeah! It’s work fine.

    The problem is copy+paste because changes the quotes. If you put the quotes equal the code rules!

    Thanks a lot Benno!

  6. Fadi Says:

    i couldn’t find this directory :S

    com_docman/includes/files.php

    mine is just com_docman/inculde_frontend

    please help..

  7. Catalin Says:

    Funny, i also get “Error Uploading. - No filename specified.”
    Could there be a problem with this patching?

    [b]EDIT[/b]
    If i don’t apply the patch to DOCMAN_file.class.php (last of the 3) it works… probably this is because i run it on a local test site, in XP. Who knows.

  8. Sayeed Says:

    When trying to upload file this error shows:
    A filename is required

    plz help me.

  9. Viet8x Says:

    Thanks so much!

  10. Humandecoy Says:

    Am I correct that

    com_docman/includes_frontend/upload.http.php
    is in the directory
    /components

    and
    com_docman/includes/files.php
    is /administrator/components/com_docman

    I want to make sure before I, newby, start messing with the code.

    (I think this would also answer Fadi who says he can’t find
    com_docman/includes/files.php).

    Thanks

  11. Steve Hernandez Says:

    JOOMLA/components/com_docman/includes_frontend/upload.http.php
    JOOMLA/administrator/components/com_docman/includes/files.php
    JOOMLA/administrator/components/com_docman/classes/DOCMAN_file.class.php

    Where JOOMLA is the root / home folder of the joomla installation (not to be confused with the root folder of the server).

    I hope this helps and clears up some confusion.

  12. Humandecoy Says:

    Tried it (after I figured out that the files you mention are in different directories, it would help if you added that to your instructions) , it works!

    Thanks!

  13. ghjk Says:

    I changed te code. but nothing happened. Still I can’t upload files from front end and didn’t give any error message.

  14. reddy Says:

    GR8. worked. thanks

  15. lamsieuquay Says:

    docman.class.php

    //———–Langue Addin———————————–Line 313
    function loadLanguage($type)
    {
    global $mosConfig_lang;

    if (file_exists($this->getPath(’language’).’/’.$mosConfig_lang.’.’.$type.’.php’)) {
    include_once ($this->getPath(’language’).’/’.$mosConfig_lang.’.’.$type.’.php’);
    } else {
    include_once ($this->getPath(’language’).’/english.’.$type.’.php’);
    }
    }

  16. Ufuk Says:

    Thanks. it works. code in site musn’t copy paste. Because it gives mistake.

  17. bbxrider Says:

    thanks a million benno, nice work, can you debug my next php project? also a bonus, until this fix i was getting a file exceeded max size error, which was way off due to large limits i had set.
    udamon
    bob

Leave a Reply