SteveOH

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

by on Jul.11, 2008, under Technology

I have verified that this 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 handle them, and is resulting in unpredictable behavior.

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

/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 ).


Hello I’ve had the error message “error uploading. directory ” with DOCman 1.4 RC3, debugged the code and found the – 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 -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

:, , , , , , ,

29 Comments for this entry

  • basjoomla

    Thks Great fix (Y)(Y)

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

  • Ramón

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

  • Steve Hernandez

    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.

  • Hynnot

    Thanks but now I have this error:

    A filename is required.

    :(

  • Hynnot

    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!

  • Fadi

    i couldn’t find this directory :S

    com_docman/includes/files.php

    mine is just com_docman/inculde_frontend

    please help..

  • Catalin

    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.

  • Sayeed

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

    plz help me.

  • Viet8x

    Thanks so much!

  • Humandecoy

    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

  • Steve Hernandez

    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.

  • Humandecoy

    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!

  • ghjk

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

  • lamsieuquay

    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’);
    }
    }

  • Ufuk

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

  • bbxrider

    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

  • Brian

    I had made the changes to all the correct files and was still getting “No Filename Specified” error, I went back and I noticed in cutting and pasting it copies everything ok, EXCEPT the quotation marks. You’ll need to go back and correct those using ‘ ‘ quotes.

    Hope that helps someone……

  • Steve Hernandez

    Yes, that’s stated in the first EDIT in the post.

    Thanks though. Happy it helped you.

  • Chinglai

    Thanks!!

    It works..but the file being uploaded cannot be wiewed in the site.
    Please help!! im a newbie..

  • Jim

    Wow, thanks that was a huge help! And a big thanks to Brian as well who pointed out the problem with the cut n’ paste with the quotation marks. I had the same problem of “No Filename Specified” error, until I changed:

    from: $file_upload = mosGetParam($_FILES, ‘upload’);
    to: $file_upload = mosGetParam($_FILES, ‘upload’);

    That’s a very subtle difference when looking at small text, but it makes the difference between it working and not working.

    Thanks again, Steve, this site is incredibly valuable and appreciated.

  • MOHAX

    Спасибо Ваш ответ очень помог. ОГРОМНОЕ СПАСИБО!!!

  • Red

    Worked Great! Thanks a bunch!!!!!

  • Harshit

    It helped me a lot

    Thank you all very much……….

  • Glenn

    I still get The error “A filename is required” when a public upload on the front end is attempted, no matter what the file is. Could someone please help with this A fielname is required error?

  • Norton

    I had the “A filename is required” error, and it turned out to be something outside of the joomla/docman setup.

    Check your php.ini file and make sure that uploads are enabled, like so:
    file_uploads = On

  • Glenn Kimball

    I’m still stuck with “A filename is require” error and cannot get it fixed. My php.ini file_uploads=On and I’ve got the most recent update of docman. Any ideas on how to troubleshoot?

  • Andreas

    Any solutions for the “A filename is required” error?

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!