The CubeCart file and image uploader in the product editor only allows for a small set of file types: jpg, gif, jpeg, png, swf, fla, jpg, gif, jpeg, png, avi, mpg, and mpeg. If you want to upload a PDF in CubeCart, you will have to manually FTP it into the uploads folder, and even then the file browser won’t show you PDFs. If you try to upload PDFs, you’ll get the following alert: “Invalid file type.” Well here’s how to fix that.
1. Make the uploaded file type valid.
- Go to `[your site]/admin/includes/rte/editor/filemanager/connectors/php/config.php`
- Near the bottom of the file (around line 191), you should see this:
$Config['AllowedExtensions']['uploads'] = array('jpg','gif','jpeg','png','swf','fla','jpg','gif','jpeg','png','avi','mpg','mpeg') ;
- Add additional file formats you want to include, or you can replace the code with this (which adds a ton of file extensions):
$Config['AllowedExtensions']['uploads'] = array('7z', 'aiff', 'asf', 'avi', 'bmp', 'csv', 'doc', 'docx', 'fla', 'flv', 'gif', 'gz', 'gzip', 'jpeg', 'jpg', 'mid', 'mov', 'mp3', 'mp4', 'mpc', 'mpeg', 'mpg', 'ods', 'odt', 'pdf', 'pdfx', 'png', 'ppt', 'pxd', 'qt', 'ram', 'rar', 'rm', 'rmi', 'rmvb', 'rtf', 'sdc', 'sitd', 'swf', 'sxc', 'sxw', 'tar', 'tgz', 'tif', 'tiff', 'txt', 'vsd', 'wav', 'wma', 'wmv', 'xls', 'xml', 'zip')
- Save the file
2. Make the files visible in the file browser
Now that you can upload files, you want to be able to see them in the file browser.
- Go to `[your site]/admin/includes/rte/editor/filemanager/connectors/php/commands.php`
- Around line 71, find the following code:
- and replace it with this:
- Now, every normal file extension should be visible
3. Enjoy uploading non-image files to CubeCart
It’s pretty silly that CubeCart limited this in the first place, but at least the fix is relatively painless. Remember – if you upgrade CubeCart in the future, these changes will be lost.
1 reply on “Enable PDF Uploads in CubeCart 4”
Thanks for the article but I still can’t see PDF files in the pop up browser window. I have copied your code exactly using version 4.4.3. Anyone else having issues?