DOCman 1.4 RC3: Error Uploading. Directory Problem. *FIX*
by Steve Hernandez on Jul.11, 2008, under Technology
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. ![]()
Good luck!
Benno
July 23rd, 2008 on 11:31 PM
Thks Great fix (Y)(Y)
BTW http://www.ouagaguide.com is not done with joomla but oldscool code
July 24th, 2008 on 3:08 PM
Don’t work for me.
I did all you say step to step and now i have a new error: A filename is required
July 24th, 2008 on 5:56 PM
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.
August 5th, 2008 on 12:28 PM
Thanks but now I have this error:
A filename is required.
August 5th, 2008 on 12:34 PM
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!
August 6th, 2008 on 2:31 PM
i couldn’t find this directory :S
com_docman/includes/files.php
mine is just com_docman/inculde_frontend
please help..
August 6th, 2008 on 4:54 PM
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.
August 11th, 2008 on 10:38 AM
When trying to upload file this error shows:
A filename is required
plz help me.
July 22nd, 2009 on 11:41 PM
I have the same error problem. On frontend uploads the user gets “A filename is required” and the document does not open. Anyone have help for this?
August 15th, 2008 on 7:14 AM
Thanks so much!
August 27th, 2008 on 9:22 PM
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
August 27th, 2008 on 9:43 PM
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.
August 27th, 2008 on 11:29 PM
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!
September 4th, 2008 on 1:52 PM
I changed te code. but nothing happened. Still I can’t upload files from front end and didn’t give any error message.
November 8th, 2008 on 7:01 PM
GR8. worked. thanks
November 18th, 2008 on 3:12 PM
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’);
}
}
December 23rd, 2008 on 4:03 AM
Thanks. it works. code in site musn’t copy paste. Because it gives mistake.
January 6th, 2009 on 10:24 AM
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
January 8th, 2009 on 12:33 AM
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……
January 8th, 2009 on 12:34 AM
Yes, that’s stated in the first EDIT in the post.
Thanks though. Happy it helped you.
January 8th, 2009 on 4:31 PM
Thanks!!
It works..but the file being uploaded cannot be wiewed in the site.
Please help!! im a newbie..
February 13th, 2009 on 3:28 AM
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.
February 13th, 2009 on 1:16 PM
Спасибо Ваш ответ очень помог. ОГРОМНОЕ СПАСИБО!!!
February 21st, 2009 on 12:46 AM
Worked Great! Thanks a bunch!!!!!
March 5th, 2009 on 11:11 PM
It helped me a lot
Thank you all very much……….
July 12th, 2009 on 9:08 PM
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?
August 28th, 2009 on 2:03 AM
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
September 28th, 2009 on 3:04 AM
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?