Jump to content

My download links are corrupted!


Recommended Posts

Please help! I have a clipart website where I sell my graphics that I draw. I recently upgraded my cart to the new version and now my older download links are corrupt! Here is an example of one that is corrupt http://www.clipartwhimsy.com/product.php?id_product=301 When a customer orders one they cannot open the download link. It says "The file “example.png” could not be opened. It may be damaged or use a file format that Preview doesn’t recognize." But, when I go into the product, the file link is there and it does not say missing file. Does anyone know how I would go about fixing this? Is the file corrupt or is the link corrupt? If it is just the download link, is there a way to generate a new download link without having to re-upload the file? Also, where are my actual downloads stored? Are they in my database?
Thanks,

Link to comment
Share on other sites

Should also add that I did backup my database and my store. Should I be looking into that and use that somehow to fix the problem? And if so how do I use my database backup and store backup to go back to how it was before the problem?

Link to comment
Share on other sites

Downloadable products and attachments are stored in the download directory in the root of PrestaShop. The files are renamed to a hash code. If your links aren't working, it is most likely that new hash codes were generated, but the file wasn't renamed to the new hash code, so it can't be found. You should use phpMyAdmin to edit the ps_product_download table of your database and make sure that the hash code in the "physically_filename" field matches the hash code of the file in the download directory. If they don't match, you'll need to change the hash in the database to the filename or rename the file to the hash in the database.

Link to comment
Share on other sites

  • 4 weeks later...

Rocky, thanks for your reply on this.

I have found the hash codes in both my phpMyAdmin and in my ftp manager. The hash codes are the same. Example of download link string:
http://www.clipartwhimsy.com/get-file.php?key=46ae7fab2df6a5f8bf075dbc751bc48a85fd9e0d-58ba0794a514e9d4d1e4bf2a06ee163f1c2cc452
The physical filename is 46ae7fab2df6a5f8bf075dbc751bc48a85fd9e0d and there is a file named that in my download directory. But, I can't find the second long number of 58ba0794a514e9d4d1e4bf2a06ee163f1c2cc452 anywhere. Could this be the problem? And if so, how do I fix it?

Also, is there another way to get the product file so that I can just re-upload it?

Link to comment
Share on other sites

The first hash is the filename of the file and second hash is the download_hash in the ps_order_detail table. They must both match, otherwise the download links will fail. The reason there are two hashes is to determine whether the current customer has a valid order to download the file.

You should be able to re-upload a product download from the "1. Info." tab of the product editor and the hash should remain the same. That's why I do on my website. The only problem is that if you changed the name of the product, the existing orders will always have the old name of the product. On my website, I fix this by running an SQL query on my ps_order_detail table to replace the old product name with the new one.

Link to comment
Share on other sites

Rocky, Thanks for the reply. I checked to make sure that both hash codes were correct and tried several different order codes for that download for the second has code and still no go. So, do you think this means the file is indeed damaged? One other thing I was going to try is to make a test site and a test database for it, then restore my database back to what it was before I upgraded. Then try to make a purchase from the test store to see if that works. I'll post an update if it works or doesn't.

Link to comment
Share on other sites

Perhaps. Try downloading the file and adding ".zip" or whatever extension the files should be and then try opening them to determine whether they are corrupt.

Yes, check whether adding a new download has the same problem or whether it is just existing downloads with the problem.

Link to comment
Share on other sites

I thought about that, but it doesn't work even on the files that I know are good. I just tested one that I know is not corrupt and adding the file extension does nothing. It's seems like it is more like having the whole string together retrieves the file or something, which makes me wonder if the actual file is stored somewhere else? I am in the process of just testing a database restore and seeing if that works.

Link to comment
Share on other sites

  • 2 weeks later...

I had this problem with corrupt links on larger files as well after upgrade but then remembered I had added this line,

ob_end_flush();

to the get_file.php file according to thread,
http://www.prestashop.com/forums/viewthread/35893/configuring___using_prestashop/solved_problem_uploading_downloadable_files_exceeding_14mb

After I added this line to the new get_file.php the links all worked.

Tim

Link to comment
Share on other sites

  • 3 years later...

I have the same problem and I could not solve it since a year. I'm really desperate :angry: . I use prestashop 1.5.1;

 

I need somebody to help me fixing this:

 

1. Download products files last a few days, then get corrupted, and I have to replace them (they are heavy files like 50mb to 1gb). I have tried downloading them (via ftp) and adding .zip, and they work fine. :-(  .   I use .txt method to upload big files.

 

2. Sheet attached to products get corrupted the same way, and they are light pdf. 

 

I need to solve it. I can pay. Please help me :)

 

Luca.

Edited by Lucagiaicheca (see edit history)
Link to comment
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
×
×
  • Create New...