Page 1 of 1

1.5.12 joomla.filesystem.file FTP bug?

Posted: Wed Jul 01, 2009 7:24 pm
by drewgg
After updating to 1.5.12 a component (that included image uploading) started erring, saying the file failed to upload. However, the files were successfully being uploaded into the destination directory.

The component is calling JFile::upload() which is located in /libraries/joomla/filesystem/file.php (line 311).

The change made to this function was due to this bug report: http://joomlacode.org/gf/project/joomla ... m_id=16593

The code change was here:

1.5.11 ->

Code: Select all

			// Copy the file to the destination directory
			if ($ftp->store($src, $dest)) {
				$ftp->chmod($dest, 0777);
				$ret = true;
			} else {
				JError::raiseWarning(21, JText::_('WARNFS_ERR02'));
			}
1.5.12 ->

Code: Select all

			// Copy the file to the destination directory
			if (is_uploaded_file($src) && $ftp->store($src, $dest))
			{
                		unlink($src);
			} else {
				JError::raiseWarning(21, JText::_('WARNFS_ERR02'));
			}
The missing $ret = true; results in the JFile::upload() returning false even though the file is successfully uploaded.

Adding the $ret = true; back in solved the issue.

Code: Select all

			// Copy the file to the destination directory
			if (is_uploaded_file($src) && $ftp->store($src, $dest))
			{
                		$ret = true;
                		unlink($src);
			} else {
				JError::raiseWarning(21, JText::_('WARNFS_ERR02'));
			}

Re: 1.5.12 joomla.filesystem.file FTP bug?

Posted: Wed Jul 01, 2009 7:31 pm
by Robin
Hi,

Thanks for raising the issue and including a possible patch. I've notified the Bug Squad about your post so they won't miss it.

Re: 1.5.12 joomla.filesystem.file FTP bug?

Posted: Wed Jul 01, 2009 9:37 pm
by vickipayne

Code: Select all

         // Copy the file to the destination directory
         if (is_uploaded_file($src) && $ftp->store($src, $dest))
         {
                      $ret = true;
                      unlink($src);
         } else {
            JError::raiseWarning(21, JText::_('WARNFS_ERR02'));
         }
Thank you for posting this fix, drewgg. It got rid of the upload error for me.

Re: 1.5.12 joomla.filesystem.file FTP bug?

Posted: Wed Jul 01, 2009 9:50 pm
by airton
Hello drewgg and vickipayne,

Can you please test the patch at http://joomlacode.org/gf/project/joomla ... m_id=17053 and see if it corrects the issue?

Thanks,

Re: 1.5.12 joomla.filesystem.file FTP bug?

Posted: Wed Jul 01, 2009 10:07 pm
by vickipayne
Hi, airton. I don't have a patch utility to adequately test your file, but I've "hand-installed" patches before and this one looks correct.

Thanks,
Vicki

Re: 1.5.12 joomla.filesystem.file FTP bug?

Posted: Thu Jul 02, 2009 1:24 pm
by drewgg
I am in the same boat as vickipayne about not using a patch utility but the patch looks correct according to my knowledge (looking at the patch structure, line number/length change, and code change).

Re: 1.5.12 joomla.filesystem.file FTP bug?

Posted: Sat Jul 04, 2009 1:49 pm
by JoomArt
Thanks drewgg....that was helpful

Re: 1.5.12 joomla.filesystem.file FTP bug?

Posted: Sat Jul 04, 2009 11:46 pm
by archinovum
I just wanted to thank you - you really made my day :-)

Quick and Dummy-Friendly solution!!!

Greeets

Michael

Re: 1.5.12 joomla.filesystem.file FTP bug?

Posted: Mon Jul 06, 2009 7:34 am
by weting
One more thank you for your simple and easy solution.

/I

Re: 1.5.12 joomla.filesystem.file FTP bug?

Posted: Tue Jul 07, 2009 8:14 pm
by koolie
Thanks a ton. Solved by problem instantly!

Re: 1.5.12 joomla.filesystem.file FTP bug?

Posted: Thu Jul 09, 2009 11:49 am
by itaym
for me it doesnt work.

after i upload i get this error:

JFTP::store: Bad response
Warning: Failed to move file!
Error. Unable to upload file.


any suggestions?

Re: 1.5.12 joomla.filesystem.file FTP bug?

Posted: Thu Jul 09, 2009 12:05 pm
by mandville
itaym wrote:for me it doesnt work.

after i upload i get this error:

JFTP::store: Bad response
Warning: Failed to move file!
Error. Unable to upload file.


any suggestions?
that is more a permissions issue, search the forums for JFTP::store:

Re: 1.5.12 joomla.filesystem.file FTP bug?

Posted: Thu Jul 09, 2009 12:57 pm
by itaym
yes.
in other site it's working.
i believe its another issue.
i will check.

Thnak you!!

Re: 1.5.12 joomla.filesystem.file FTP bug?

Posted: Fri Jul 10, 2009 12:33 am
by sparkosis
This suggested solution worked for me. I was having trouble uploading images in the backend with JCE, and image uploads in front and backend with JoomGallery. I thought it was a JoomGallery issue until I found the JCE issue.

Changing /libraries/joomla/filesystem/file.php as recommended fixed everything.

Thank you, thank you, thank you!!!
Richard

Re: 1.5.12 joomla.filesystem.file FTP bug?

Posted: Mon Jul 13, 2009 10:42 pm
by CDTOAadmin41
drewgg wrote:After updating to 1.5.12 a component (that included image uploading) started erring, saying the file failed to upload. However, the files were successfully being uploaded into the destination directory.

The component is calling JFile::upload() which is located in /libraries/joomla/filesystem/file.php (line 311).

The change made to this function was due to this bug report: http://joomlacode.org/gf/project/joomla ... m_id=16593

The code change was here:

1.5.11 ->

Code: Select all

			// Copy the file to the destination directory
			if ($ftp->store($src, $dest)) {
				$ftp->chmod($dest, 0777);
				$ret = true;
			} else {
				JError::raiseWarning(21, JText::_('WARNFS_ERR02'));
			}
1.5.12 ->

Code: Select all

			// Copy the file to the destination directory
			if (is_uploaded_file($src) && $ftp->store($src, $dest))
			{
                		unlink($src);
			} else {
				JError::raiseWarning(21, JText::_('WARNFS_ERR02'));
			}
The missing $ret = true; results in the JFile::upload() returning false even though the file is successfully uploaded.

Adding the $ret = true; back in solved the issue.

Code: Select all

			// Copy the file to the destination directory
			if (is_uploaded_file($src) && $ftp->store($src, $dest))
			{
                		$ret = true;
                		unlink($src);
			} else {
				JError::raiseWarning(21, JText::_('WARNFS_ERR02'));
			}
my update patch had the code all ready, my issue is that when I upload an image in the Media Manager, the image uploads "completed", but you can not see the image thumb.

my Linux administrator was let go, so i am guessing my work, :(

Re: 1.5.12 joomla.filesystem.file FTP bug?

Posted: Sat Jul 18, 2009 2:35 am
by Helaman
thanks fixed my problem with the uploading error! :p :p :p

Re: 1.5.12 joomla.filesystem.file FTP bug?

Posted: Sat Jul 18, 2009 6:57 am
by mandville
CDTOAadmin41 wrote: my update patch had the code all ready, my issue is that when I upload an image in the Media Manager, the image uploads "completed", but you can not see the image thumb.

my Linux administrator was let go, so i am guessing my work, :(
sounds stupid, but you do have media manager on the thumbnail view and not the detail view

Re: 1.5.12 joomla.filesystem.file FTP bug?

Posted: Mon Jul 20, 2009 2:59 pm
by CDTOAadmin41
mandville wrote:
CDTOAadmin41 wrote: my update patch had the code all ready, my issue is that when I upload an image in the Media Manager, the image uploads "completed", but you can not see the image thumb.

my Linux administrator was let go, so i am guessing my work, :(
sounds stupid, but you do have media manager on the thumbnail view and not the detail view
so I guess I figured the issue this weekend.
some folders where locked after the install of 1.5.12, so I gave my self different permissions. also the FTP configurations where changed to some default mode. here at work we host our own servers, so we have more options then the norm. the file folder was set to 775

Re: 1.5.12 joomla.filesystem.file FTP bug?

Posted: Tue Jul 21, 2009 3:56 pm
by dyrer
Thanks works for me. Am waiting for joomla 1.5.13

Re: 1.5.12 joomla.filesystem.file FTP bug?

Posted: Thu Jul 23, 2009 6:19 am
by airton
Hi all,

J1.5.13 has just been released with this and other fixes. See my signature. :)

Regards,

Re: 1.5.12 joomla.filesystem.file FTP bug?

Posted: Wed Apr 14, 2010 10:06 am
by marrydavidson
thanks for sharing this

Re: 1.5.12 joomla.filesystem.file FTP bug?

Posted: Wed Sep 08, 2010 10:07 pm
by Varsys
It worked! Thanks for sharing the fix.

Re: 1.5.12 joomla.filesystem.file FTP bug?

Posted: Fri Dec 17, 2010 9:55 am
by xbox361
Not arguable at all. And if you took the trouble to read the bug tracker ad the changelog you would see why the change was made and what the correction to the new code should be. I’m very sad to see a developer thinking that chmod 777 can ever be a good solution. I’m thinking I’m very glad I don’t use your extensions if you think 777 is a good solution.