Ragazzi ho risolto.
Rilevato bug per upload file in joomla 1.5.12
Riporto quanto ho trovato in un forum. Spero sia utile a chi ha gli stessi problemi.
Per chi vuole leggerlo nella pagina web specifica, il link è:
http://forum.joomla.org/viewtopic.php?f=199&t=416166After 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:
// 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:
// 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:
// 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'));
}
Top
E-mail
Robin
Post subject: Re: 1.5.12 joomla.filesystem.file FTP bug?
Posted: Wed Jul 01, 2009 7:31 pm
User avatar
Joomla! Master
Joomla! Master
Online
Joined: Thu Aug 18, 2005 10:41 am
Posts: 15033
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.
_________________
Regards Robin - Forum Admin - Global Moderator - Community & Leadership Team
Top
E-mail
vickipayne
Post subject: Re: 1.5.12 joomla.filesystem.file FTP bug?
Posted: Wed Jul 01, 2009 9:37 pm
Joomla! Apprentice
Joomla! Apprentice
Offline
Joined: Wed Jan 28, 2009 7:27 pm
Posts: 17
Code:
// 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.