Hi folks,
I'm building a store on 3.0.3.8 M.B. that will sell encrypted sound files. They are encrypted by the manufacturer to be used exclusively on their products.
I have added the new extensions to the Upload > allowed file extensions, under the server tab. But I keep getting "Invalid file type" when trying to upload them at catalog > downloads.
I have cleared caches, refreshed pages, changed browsers and checked site errors. I cant figure out what I'm doing wrong.
Any suggestions? Or am I missing anything?
I'm building a store on 3.0.3.8 M.B. that will sell encrypted sound files. They are encrypted by the manufacturer to be used exclusively on their products.
I have added the new extensions to the Upload > allowed file extensions, under the server tab. But I keep getting "Invalid file type" when trying to upload them at catalog > downloads.
I have cleared caches, refreshed pages, changed browsers and checked site errors. I cant figure out what I'm doing wrong.
Any suggestions? Or am I missing anything?
Last edited by FnF on Tue Jun 13, 2023 7:54 am, edited 1 time in total.
Hi Add Creative,
I have added the new extensions to the Upload > allowed file extensions, under the server tab. But not under Mimes.
If they need to be added there, I'm unsure on what info to enter there.
You can probably find an online tool that will tell you the MIME type of your files.
I've tried that too. But thanks. I'm beginning to think the extensions are manufacture specific so they wont be on any known "mime type" list. I'm going to ask the manufacturer tomorrow for some info on this. I'll report back with my findings.
I DID notice that I can upload all the files via ftp or Cpanel and avoid the upload option within OC that gives the file an automatic mask.
Which brings up a new question for me. While testing this I added my own mask while adding the download as an actual product, but what does the end user (customer) do with this?
The masked downloaded file actually gets a new extension which is the mask name once it's downloaded. I understand why the mask is needed but I dont understand how the customer will be able to use the product with it being named with a new unknown extension which is the file mask.
IE: song.mp3.filemaskname
EDIT: I answered my own question on the file mask while digging through it some more. The file mask should be made with the same extension as the original file. Not just a series of letters or numbers. For example "song.mp3" could be masked with "002.mp3"
I DID notice that I can upload all the files via ftp or Cpanel and avoid the upload option within OC that gives the file an automatic mask.
Which brings up a new question for me. While testing this I added my own mask while adding the download as an actual product, but what does the end user (customer) do with this?
The masked downloaded file actually gets a new extension which is the mask name once it's downloaded. I understand why the mask is needed but I dont understand how the customer will be able to use the product with it being named with a new unknown extension which is the file mask.
IE: song.mp3.filemaskname
EDIT: I answered my own question on the file mask while digging through it some more. The file mask should be made with the same extension as the original file. Not just a series of letters or numbers. For example "song.mp3" could be masked with "002.mp3"
You can find list of the types at the link below.
https://developer.mozilla.org/en-US/doc ... MIME_types
In OpenCart the Mask is the filename the customer sees. So you would set it to song.mp3. The filename is the actual filename of the file in the storage/download directory. For security it should have a random part to it, so song.mp3.rdcj9e32ujd93ndSDfdsfsd. Although if your storage directory is not accessible then it shouldn't be an issue. If you upload the file via OpenCart it will automatically add this.
https://developer.mozilla.org/en-US/doc ... MIME_types
In OpenCart the Mask is the filename the customer sees. So you would set it to song.mp3. The filename is the actual filename of the file in the storage/download directory. For security it should have a random part to it, so song.mp3.rdcj9e32ujd93ndSDfdsfsd. Although if your storage directory is not accessible then it shouldn't be an issue. If you upload the file via OpenCart it will automatically add this.
It might be you also need to tell your webserver that it's ok to serve those files, I think in the .htaccess.
UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk
I did do that part too Paul.paulfeakins wrote: ↑Mon Jun 12, 2023 9:45 pmIt might be you also need to tell your webserver that it's ok to serve those files, I think in the .htaccess.
Cpanel lets you add "user created" mime types to the allowable mime list. But I never go that to work either.
I'm fairly confident in saying that the reason it wont work is because I simply do not know which mime type to list these extensions with. It is absolutely beyond me. And when I Google it, I cant get any consistency with the search results. It makes me feel like there is a plethora of types to associate them with and I cant pin down the right one.
After contacting the manufacturer regarding the Mime types used, they had no idea what I was talking about. So I think at this point I'm going to upload them myself to the Download directory and avoid OC's association process which asks for the mime type.
Even though I didnt get the Upload function within OC to accept these, I'm still going to mark this solved since there's is a way to bypass that and get them uploaded and listed as products, which is what I was looking for when I started the topic.
Thank you very much @ADD Creative, for all your help. Very much appreciated sir.
You could make a temporary change to admin/controller/catalog/download.php to display the MINE type in the error.
Change.
To.
Or even just log $this->request->files['file']['type'] in the upload method.
Change.
Code: Select all
if (!in_array($this->request->files['file']['type'], $allowed)) {
$json['error'] = $this->language->get('error_filetype');
}
Code: Select all
if (!in_array($this->request->files['file']['type'], $allowed)) {
$json['error'] = $this->language->get('error_filetype') . ' ' . $this->request->files['file']['type'];
}
Ok, yeah I wasnt aware of that.ADD Creative wrote: ↑Tue Jun 13, 2023 3:47 pmYou could make a temporary change to admin/controller/catalog/download.php to display the MINE type in the error.
Even though I have them uploaded now I may have to give that a shot. It would be handy for adding any new products down the road.
Thank again Paul
Who is online
Users browsing this forum: Amazon [Bot] and 19 guests