Post by bobbyh » Wed Jul 27, 2011 5:13 am

Hi,

Just setting up the options for our site and when we set up a file upload option it says " Invalid file type!".
Can anyone tell me why this is so? Do I have to put in a setting to allow .jpg files. We tested on very small ones and still not working.

Here s a test page product to see:
http://dev.letterfest.com/index.php?rou ... duct_id=51

Any ideas why the error appears?

Cheers
Bob

New member

Posts

Joined
Fri Jul 01, 2011 2:48 am

Post by bobbyh » Wed Jul 27, 2011 6:32 pm

Hi Again,

Still not found a solution to the customer uploads issue. However I have found the code for it in the system:
catalog/controller/product/product.php


Seems it's a list of file types that are 'allowed' -be great to find out where the list of file types is set?
Also can anyone tell me where the files should be saved to and how we access any successful uploads by customers?

Here is the code for getting the file types allowed to be loaded:

Code: Select all

$allowed = array();
$filetypes = explode(',', $this->config->get('config_upload_allowed'));

Here is all the code for the upload:

Code: Select all

if (isset($this->request->files['file']['name']) && $this->request->files['file']['name']) {
			if ((strlen(utf8_decode($this->request->files['file']['name'])) < 3) || (strlen(utf8_decode($this->request->files['file']['name'])) > 128)) {
        		$json['error'] = $this->language->get('error_filename');
	  		}	  	
			
			$allowed = array();
 			$filetypes = explode(',', $this->config->get('config_upload_allowed'));
			
			foreach ($filetypes as $filetype) {
				$allowed[] = trim($filetype);
			}
			
			if (!in_array(substr(strrchr($this->request->files['file']['name'], '.'), 1), $allowed)) {
				$json['error'] = $this->language->get('error_filetype');
       		}	
						
			if ($this->request->files['file']['error'] != UPLOAD_ERR_OK) {
				$json['error'] = $this->language->get('error_upload_' . $this->request->files['file']['error']);
			}
		} else {
			$json['error'] = $this->language->get('error_upload');
		}
		
		if (($this->request->server['REQUEST_METHOD'] == 'POST') && !isset($json['error'])) {
			if (is_uploaded_file($this->request->files['file']['tmp_name']) && file_exists($this->request->files['file']['tmp_name'])) {
				$file = basename($this->request->files['file']['name']) . '.' . md5(rand());
				
				// Hide the uploaded file name sop people can not link to it directly.
				$this->load->library('encryption');
				
				$encryption = new Encryption($this->config->get('config_encryption'));
				
				$json['file'] = $encryption->encrypt($file);
				
				move_uploaded_file($this->request->files['file']['tmp_name'], DIR_DOWNLOAD . $file);
			}
						
			$json['success'] = $this->language->get('text_upload');
		}	
		
Any ideas chaps?

Many thanks

Bob

New member

Posts

Joined
Fri Jul 01, 2011 2:48 am

Post by uksitebuilder » Wed Jul 27, 2011 6:42 pm

filetypes are set in:

admin -> system -> settings

Option tab (look near bottom of that page)

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by bobbyh » Wed Jul 27, 2011 7:02 pm

DOH!

So easy when you know how. Works a treat.
Do you have a setting for the file size by any chance? Or is it just down to the settings for the server...

Many thanks for the help - much appreciated.

Bob

New member

Posts

Joined
Fri Jul 01, 2011 2:48 am

Post by Qphoria » Wed Jul 27, 2011 9:48 pm

bobbyh wrote:DOH!

So easy when you know how. Works a treat.
Do you have a setting for the file size by any chance? Or is it just down to the settings for the server...

Many thanks for the help - much appreciated.

Bob
Size is limited by server at this time.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by bobbyh » Wed Jul 27, 2011 10:01 pm

OK - many thanks.

Bob

New member

Posts

Joined
Fri Jul 01, 2011 2:48 am

Post by opencart-templates » Mon Aug 08, 2011 10:14 pm

uksitebuilder wrote:filetypes are set in:

admin -> system -> settings

Option tab (look near bottom of that page)
For me it wasn't quite that easy, I wanted to be able to upload .ico files into the fav-icon

Edit file: /admin/controller/common.filemanager.php

First edit the upload() method:

Code: Select all

$allowed = array(
	'image/jpeg',
	'image/pjpeg',
	'image/png',
	'image/x-png',
	'image/gif',
	'image/x-icon',
	'application/x-shockwave-flash'
);
Also change to:

Code: Select all

$allowed = array(
	'.jpg',
	'.jpeg',
	'.gif',
	'.png',
	'.ico',
	'.flv'
);
For the files to be displayed in the upload manager you also need to edit the files() method adding to the allowed arrray.

Code: Select all

$allowed = array(
	'.jpg',
	'.jpeg',
	'.png',
	'.ico',
	'.gif'
);

Advanced Professional Email Template
Customers Pre-Sale. Inc abandoned cart email
Order Follow-Up Email. Inc request review
Email Validation with ZeroBounce


User avatar
Active Member

Posts

Joined
Mon May 16, 2011 7:24 pm
Location - UK

Post by keiron1992 » Wed Apr 25, 2012 5:37 am

What should the permission be set to? What number? I've tried everything I can;t upload .xml to my site using VQmod. I've updated OC, upadated VQmod, added XML, xml to the admin options and even added it to the admin/controller/common/filemanager.tpl file.

Can someone help me please? I'm trying not to use FTP, it works fine through that but I would like to use the upload feature.

New member

Posts

Joined
Fri Oct 22, 2010 12:02 am
Location - Birmingham, West Midlands, Uk

Post by hudbarnett » Thu Nov 15, 2012 12:10 am

where do the files go once a customer uploads an image? i have been searching and cannot find the directory the holds all uploaded images..

:)

New member

Posts

Joined
Thu Mar 29, 2012 9:46 pm

Post by digitaldept » Thu Feb 07, 2013 12:07 am

I'm curious to see if you solved this problem?I am having the same issue on OC 1.5.5.1.
Thanks!

New member

Posts

Joined
Fri Aug 31, 2012 12:12 pm
Location - Ohio

Post by griff4594 » Tue Apr 02, 2013 11:20 pm

I too am also having this problem in 1.5.5.1, no matter how I modify the settings in the admin or the filemanager.php file I cannot upload anything through the file manager.

Kevin Griffith
Developer


Newbie

Posts

Joined
Mon Feb 04, 2013 11:32 pm


Post by teJ20 » Mon Apr 22, 2013 5:28 pm

I have the same problem, any idea?

Newbie

Posts

Joined
Sun Feb 03, 2013 10:19 pm

Post by griff4594 » Thu May 02, 2013 4:49 am

I finally figured it out later that day, it is a setting of MIME types you have to enter into the store settings area. You have to enter the MIME type then the file type. EX: image/jpg

Kevin Griffith
Developer


Newbie

Posts

Joined
Mon Feb 04, 2013 11:32 pm


Post by 14music » Mon Jun 03, 2013 10:54 am

I'm having problem with Opencart 1.5.5.1 too
I need to upload a zip file. I wonder if Opencart can handle zip files as digital download
Please advice

Newbie

Posts

Joined
Mon Dec 24, 2012 9:20 am

Post by 14music » Tue Jun 04, 2013 4:15 am

Ok I have managed to upload the zip files via FTP to the download folder
I am able to setup the downloads in the admin panel okay and
I tagged them to each products, seems like it's working good.
after I added to cart and make the payment
and go to my download page
It's not downloading, it kept on going and the zip file is only 3MB each

any ideas anyone

Newbie

Posts

Joined
Mon Dec 24, 2012 9:20 am

Post by limitCracker » Mon Jul 08, 2013 6:49 am

SOLUTION

http://forum.opencart.com/viewtopic.php?f=19&t=94873

add mime types:

application/zip
application/x-zip
application/octet-stream [THAT WORKED FOR ME, using WinZip]
application/zip-compressed
application/x-zip-compressed
application/x-compress

Newbie

Posts

Joined
Mon Jul 08, 2013 6:47 am

Post by Mangostine » Thu Sep 12, 2013 6:08 am

Hello,

I have a problem for download a file pdf. In system > server i added :

zip
pdf
rar

And in Mime :

application/zip
application/pdf
application/x-rar-compressed

So when i want to add a file pdf in catalog > downloads, it's not work. But for zip it works good.

Somebody do you know why ?
I use opencart 1.5.5.1.

Thanks

Newbie

Posts

Joined
Wed Sep 11, 2013 1:50 am

Post by Qphoria » Thu Sep 12, 2013 11:07 pm

Mangostine wrote:Hello,

I have a problem for download a file pdf. In system > server i added :

zip
pdf
rar

And in Mime :

application/zip
application/pdf
application/x-rar-compressed

So when i want to add a file pdf in catalog > downloads, it's not work. But for zip it works good.

Somebody do you know why ?
I use opencart 1.5.5.1.

Thanks
Did you read the post directly above yours?

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by filipboj » Tue Sep 17, 2013 1:06 am

Hi I have a problem with PSD file upload.

I am using Version 1.5.5.1 and I have updated mime type in settings part to all known mime types from (http://filext.com/file-extension/PSD):

Code: Select all

image/photoshop
image/x-photoshop
image/psd
application/photoshop
application/psd
zz-application/zz-winassoc-psd
still getting same message "Invalid file type!"
then also I have updated filemanager.php upload() function with same stuff, no help :(

Code: Select all

$allowed = array(
					'image/jpeg',
					'image/pjpeg',
					'image/png',
					'image/x-png',
					'image/gif',
					'image/photoshop',
					'image/x-photoshop',
					'image/psd',
					'application/x-shockwave-flash',
					'application/photoshop',
					'application/psd',
					'zz-application/zz-winassoc-psd'
				);
what could be solution?

Newbie

Posts

Joined
Tue Sep 17, 2013 12:58 am

Post by filipboj » Wed Sep 18, 2013 3:05 pm

it works now! :)

this is my Allowed File Mime Types: list now that works:

Code: Select all

text/plain
image/png
image/jpeg
image/gif
image/bmp
image/vnd.microsoft.icon
image/tiff
image/svg+xml
image/photoshop
image/x-photoshop
image/psd
image/vnd.adobe.photoshop
application/zip
application/x-zip
application/octet-stream
application/zip-compressed
application/x-zip-compressed
application/x-compressapplication/x-rar-compressed
application/x-msdownload
application/vnd.ms-cab-compressed
audio/mpeg
application/pdf
application/postscript
application/msword
application/rtf
application/vnd.ms-excel
application/vnd.ms-powerpoint
application/vnd.oasis.opendocument.text
application/vnd.oasis.opendocument.spreadsheet
application/photoshop
application/psd
zz-application/zz-winassoc-psd
video/quicktime
video/quicktime

Newbie

Posts

Joined
Tue Sep 17, 2013 12:58 am
Who is online

Users browsing this forum: No registered users and 363 guests