webgyrl Posted August 22, 2006 Posted August 22, 2006 Hello, I am using Joomla! 1.0.10 installed via Fantastico on Sever 366. I am wondering if someone can help me. I am trying to upload .mp3 & .m4a (Mpeg-4) files to the Media Manager in an Audio folder (permissions are set to 777 for folders). The Audio folder is in the Images folder (images/audio) I have gone into administrator/components/com_media/admin.media.php and changed the allowed file types: >acl_check( 'administration', 'edit', 'users', $my->usertype, 'components', 'all' ) | $acl->acl_check( 'administration', 'edit', 'users', $my->usertype, 'components', 'com_media' ))) { mosRedirect( 'index2.php', _NOT_AUTH ); } require_once( $mainframe->getPath( 'admin_html' ) ); /** * Makes file name safe to use * Temporary function for 1.0.x only * @param string The name of the file (not full path) * @return string The sanitised string */ function makeSafe( $file ) { return str_replace( '..', '', urldecode( $file ) ); } $cid = mosGetParam( $_POST, 'cid', array(0) ); if (!is_array( $cid )) { $cid = array(0); } $listdir = makeSafe( mosGetParam( $_REQUEST, 'listdir', '' ) ); $dirPath = makeSafe( mosGetParam( $_POST, 'dirPath', '' ) ); if (is_int(strpos ($listdir, "..")) && $listdir != '') { mosRedirect( "index2.php?option=com_media&listdir=".$_POST['dirPath'], "NO HACKING PLEASE" ); } define( 'COM_MEDIA_BASE', $mosConfig_absolute_path . DIRECTORY_SEPARATOR . 'images' ); define( 'COM_MEDIA_BASEURL', $mosConfig_live_site . '/images' ); switch ($task) { case 'upload': upload(); showMedia( $dirPath ); break; case 'newdir': if (ini_get('safe_mode')=='On') { mosRedirect( "index2.php?option=com_media&listdir=".$_POST['dirPath'], "Directory creation not allowed while running in SAFE MODE as this can cause problems." ); } else { create_folder( $dirPath ); } showMedia( $dirPath ); break; case 'delete': delete_file( $listdir ); showMedia( $listdir ); break; case 'deletefolder': delete_folder( $listdir ); showMedia( $listdir ); break; case 'list': listImages( $listdir ); break; case 'cancel': mosRedirect( 'index2.php' ); break; default: showMedia( $listdir ); break; } /** * Deletes a file * @param string The relative folder path to the file */ function delete_file( $listdir ) { $delFile = makeSafe( mosGetParam( $_REQUEST, 'delFile', '' ) ); $fullPath = COM_MEDIA_BASE . $listdir . DIRECTORY_SEPARATOR . stripslashes( $delFile ); if (file_exists( $fullPath )) { unlink( $fullPath ); } } function create_folder($dirPath) { $folder_name = mosGetParam( $_POST, 'foldername', '' ); if(strlen($folder_name) >0) { if (eregi("[^0-9a-zA-Z_]", $folder_name)) { mosRedirect( "index2.php?option=com_media&listdir=".$_POST['dirPath'], "Directory name must only contain alphanumeric characters and no spaces please." ); } $folder = COM_MEDIA_BASE . $dirPath . DIRECTORY_SEPARATOR . $folder_name; if(!is_dir( $folder ) && !is_file( $folder )) { mosMakePath( $folder ); $fp = fopen( $folder . "/index.html", "w" ); fwrite( $fp, "\n\n\n" ); fclose( $fp ); mosChmod( $folder."/index.html" ); $refresh_dirs = true; } } } function delete_folder($listdir) { $delFolder = mosGetParam( $_REQUEST, 'delFolder', '' ); $del_html = COM_MEDIA_BASE . $listdir . $delFolder . DIRECTORY_SEPARATOR . 'index.html'; $del_folder = COM_MEDIA_BASE . $listdir . $delFolder; $entry_count = 0; $dir = opendir( $del_folder ); while ($entry = readdir( $dir )) { if( $entry != "." & $entry != ".." & strtolower($entry) != "index.html" ) $entry_count++; } closedir( $dir ); if ($entry_count < 1) { @unlink( $del_html ); rmdir( $del_folder ); } else { echo 'Unable to delete: not empty!'; } } function upload() { if (isset($_FILES['upload']) && is_array($_FILES['upload']) && isset($_POST['dirPath'])) { $dirPathPost = $_POST['dirPath']; $file = $_FILES['upload']; if (strlen($dirPathPost) > 0) { if (substr($dirPathPost,0,1) == '/') { $IMG_ROOT .= $dirPathPost; } else { $IMG_ROOT = $dirPathPost; } } if (strrpos( $IMG_ROOT, '/' ) != strlen( $IMG_ROOT )-1) { $IMG_ROOT .= '/'; } do_upload( $file, COM_MEDIA_BASE . $dirPathPost . '/' ); } } function do_upload($file, $dest_dir) { global $clearUploads; if (file_exists($dest_dir.$file['name'])) { mosRedirect( "index2.php?option=com_media&listdir=".$_POST['dirPath'], "Upload FAILED.File allready exists" ); } $format = substr( $file['name'], -3 ); $allowable = array ( 'bmp', 'csv', 'doc', 'epg', 'gif', 'ico', 'jpg', 'odg', 'odp', 'ods', 'odt', 'pdf', 'png', 'ppt', 'swf', 'txt', 'xcf', 'xls', 'mp3', 'm3u', 'html', 'htm', 'wma', 'wmv', 'mov', 'mpeg', 'm4a', 'm4p', 'mp4', 'm4v', 'm4e', 'wav', ); I also went into the JCE Plugn Admin, selected "File Manager" and allowed more file types: Allowed Extensions: html,htm,doc,xls,txt,gif,jpeg,jpg,png,pdf,zip,swf,rar,tar,gz,mov,wmv,wav,mp3,m3u,mpeg m4a,m4p,mp4,m4v,m4e Viewable Files: html,htm,doc,xls,txt,gif,jpeg,jpg,png,pdf,zip,swf,rar,tar,gz,mov,wmv,wav,mp3,m3u,mpeg m4a,m4p,mp4,m4v,m4e I saved the changes to the php file and JCE File Manager plugin, logged out, cleared cookies and cache and tried to upload the file and it says "Upload Failed". Can someone tell me if I missed a step. If so, what step and how can I make it so that m4a files are allowed to be uploaded. Thank you for your help! Quote
webgyrl Posted August 22, 2006 Author Posted August 22, 2006 Looks like there is a 2MB max to upload files thru PHP! Quote
TCH-Thomas Posted August 22, 2006 Posted August 22, 2006 Try to include this in your .htaccess... >php_value upload_max_filesize 10M Quote
webgyrl Posted August 22, 2006 Author Posted August 22, 2006 Try to include this in your .htaccess... >php_value upload_max_filesize 10M Thomas! Michelle (the girl I am working with on this site) just emailed me and told me she tried something similar: >php_value memory_limit 32M php_value upload_max_filesize 8M php_value max_execution_time 800 That worked like a charm. Thanks! Quote
TCH-Thomas Posted August 22, 2006 Posted August 22, 2006 Glad to hear it works. I just took a chance on that one after some searching. Quote
TCH-JimE Posted August 23, 2006 Posted August 23, 2006 Nice going Thomas! Glad you found the answer webgyrl JimE Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.