Jump to content

Digital File names


sergempanzu

Recommended Posts

Good evening Good Day Good night,

I've currently upgraded our Digital music download shop from version 4.x to 6.22, ran into a few minor issues which I managed to fix via this forum, recently I received 2 orders which customers had issues whith downloading files, having fixed those issue I have now realised that all my 1500+ products (mp3 files) need to be renamed by replacing the spacing in each files with an underscore (or something else), basically as long as there no space in the name, for example 03-Morgan Heritage - Armagideon Calls.mp3 with now have to be renamed as 03-Morgan_Heritage -_Armagideon_Calls.mp3

Is there a code that can be applied to allow the download to recognise existing file names without me having to go through all 1500+ files

Link to comment
Share on other sites

CubeCart allows for two methods of downloading files: a direct URL and a controlled file read2buffer/bufferflush.

Using the buffer, HTTP headers are sent in the reply, including this:

Filemanager class, function deliverDownload():

header('Content-Disposition: attachment; filename="'.basename($data['file']).'"');

The filename attribute is used by the browser as the suggested filename to save the incoming data. The value must meet certain specs - of which spaces is an illegal character.

So, make this edit:

From:
header('Content-Disposition: attachment; filename="'.basename($data['file']).'"');

To:
header('Content-Disposition: attachment; filename="'.basename(rawurlencode($data['file'])).'"');

There is more to be considered, but this should be a solution for nearly every situation your customers may present you with.

This depends, of course, on where you believe the problem to be occurring. Is the function not finding the filename on the server, or...?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...