Self Hosted Downloadable Script - Stripping File Extension

gyniferhgyniferh Member
in Help edited December 2010
I've recently successfully installed the self-hosted downloadables script v.2.0. Everything is running fine with one exception...when the file is downloaded, the extension '.mp3' is stripped away.

The file is intact, if you add the .mp3 it opens fine. I'm wondering if there is a fix for this?

Thank you for any feedback.
Comments
  • lukeluke FoxyCart Team
    Hey gyniferh. Since that's a separate script from FoxyCart I'm not sure there's a whole lot we can do to help you since we don't have access to the script running directly in your environment. Do the file names you have in the database include the .mp3 extension? Your best bet would probably be to walk through the script and figure out exactly where the file name is being set. I took a quick peak and it looks like the names in the database probably need to be updated to include the file extension (along with the files themselves):
    $file_name = $product_view['file_name'];
    
    which gets set to the browser later:
    header("Content-Disposition: attachment; filename=\"$file_name\"");
    
  • Thanks Luke - hoping to give this a try tomorrow.

    Ran into a more urgent matter with this script and that has to do with the product code. First, we had to change our codes to strictly numerical. Now, as our product list grows, I think there is also a restriction on the number of digits. Seems like every product code with 10 digits is fine, 11 digits gets an error!
  • lukeluke FoxyCart Team
    Gets an error how? What's the error? Do you need to increase the size of the database field on your end?
  • gyniferhgyniferh Member
    edited December 2010
    The error comes by e-mail after the transaction has been processed. The customer receives a receipt, and then I get the error e-mail with this message:

    The following error occurred on 2010-12-09 17:35:19
    Error: Invalid product (trans: 2596677, prod: 11201618102, price: 0.00)
    Error: No link was generated for transaction #2596677

    The only thing I can see that is different is my product codes that have 11 digits, perform this way. I'm not sure how to increase the db field, but I don't think this is the problem as they import as products just fine. And with some testing, it seems any code with 10 digits or less is fine.
  • Luke! Good news your advice on the 'File Name' worked. I think what threw me off was in the instructions included in the import.php file I read this description for the file name field:

    "File Name - the name of the file as it will be presented to the customer when they download it. This can be completely different from the file's actual name on the filesystem."

    I read this and used a long title for the file name without the .mp3 extension.

    While I appreciate this script it has been challenging for me to troubleshoot through issues as they arise! I appreciate you taking the time to answer my concerns. :) Merry Christmas!
  • brettbrett FoxyCart Team
    "File Name - the name of the file as it will be presented to the customer when they download it. This can be completely different from the file's actual name on the filesystem."

    Ah, yeah, that's interesting. Thanks for pointing that out. We'll keep that in mind if anybody else runs into this.
Sign In or Register to comment.