Jump to content
Sign in to follow this  
sergempanzu

Digital File names

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

Share this post


Link to post
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...?

Edited by bsmither

Share this post


Link to post
Share on other sites

Thanks for the suggestion, unfortunately I didn't get it to work, so what I ended up doing is a Mass renaming of all files using a Powershell command, and then editing the SQL Table to do a mass rename all digital path to match file names.

But thank you :)

Share this post


Link to post
Share on other sites

So the HTML header must not be where you are experiencing the problem.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×