sergempanzu Posted December 31, 2018 Share Posted December 31, 2018 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 More sharing options...
bsmither Posted December 31, 2018 Share Posted December 31, 2018 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 More sharing options...
sergempanzu Posted December 31, 2018 Author Share Posted December 31, 2018 Which file name do I need to edit ? Link to comment Share on other sites More sharing options...
bsmither Posted December 31, 2018 Share Posted December 31, 2018 /classes/filemanager.class.php Find the public function deliverDownload(). Link to comment Share on other sites More sharing options...
sergempanzu Posted January 2, 2019 Author Share Posted January 2, 2019 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 Link to comment Share on other sites More sharing options...
bsmither Posted January 2, 2019 Share Posted January 2, 2019 So the HTML header must not be where you are experiencing the problem. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.