Theresa Arzadon-Labajo | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Menu:
Powered by Website Baker |
It also allows a user to upload a filename with spaces. However, after the file is uploaded, the user cannot delete it. I edited the code so that Joomla will preserve case as well as replace whitespace with an underscore. The file is administrator/components/com_media/admin.media.php This is the original code: (Line number 205) if (!move_uploaded_file($file['tmp_name'], $dest_dir.strtolower($file['name']))){ mosRedirect( "index2.php?option=com_media&listdir=".$_POST['dirPath'], "Upload FAILED" ); } else { mosChmod($dest_dir.strtolower($file['name'])); mosRedirect( "index2.php?option=com_media&listdir=".$_POST['dirPath'], "Upload complete" ); } Replace it with: // Strip white space from file name $new_file_name = $file['name']; $new_file_name = preg_replace('/\s+/', '_', $new_file_name); if (!move_uploaded_file($file['tmp_name'], $dest_dir.($new_file_name))){ mosRedirect( "index2.php?option=com_media&listdir=".$_POST['dirPath'], "Upload FAILED" ); } else { mosChmod($dest_dir.($new_file_name)); mosRedirect( "index2.php?option=com_media&listdir=".$_POST['dirPath'], "Upload complete" ); } Last changed: Apr 19 2007 at 3:16 PM BackComments
Add Comment |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||