Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / Problem Downloading products whose filename starts with #

Problem Downloading products whose filename starts with #

Views: 1,646

Results 1 to 20 of 32
28 Nov 2012, 7:36 PM
#1
scully avatar

scully

Zen Follower

Join Date:
Dec 2010
Posts:
257
Plugin Contributions:
0

Problem Downloading products whose filename starts with #

We're having a major issue here with customers trying to download purchased books, and getting error messages. When we had the books uploaded just as zip files, it worked fine. But now we've separated out all the file formats into epub, mobi, pdf, etc., and the books won't download.

This is the error message we're getting:

Forbidden
You don't have permission to access /zencart/pub/.xlfbvtmnxuexokrusgnn-1354130851/AustinSoutherly-ReclaimedLove.mobi on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

I presume that the /.xlfbvtmnxuexokrusgnn-1354130851 is because it's creating a secured or hidden url so that the book url can't be passed around...but why is it not downloading properly when the Attributes are set up properly (green button)?

Please help...we're hosting a really big-selling book for a friend as a favor, and the sales are coming through fast and hot...but the customers can't download their books, so we're having to manually send copies to each person, which does not reflect well.

Thank you!!

28 Nov 2012, 8:29 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Problem Downloading products whose filename starts with #

Check the .htaccess files for something similar to:

<FilesMatch ".*\.(zip|ZIP|gzip|pdf|PDF|mp3|MP3|swf|SWF|wma|WMA|wmv|WMV|wav|epub)$">

there should be 2 in there ... see if adding your file extension(s) help ...

28 Nov 2012, 8:29 PM
#3
lhungil avatar

lhungil

Totally Zenned

Join Date:
Feb 2012
Location:
mostly harmless
Posts:
1,818
Plugin Contributions:
4

Re: Problem Downloading products whose filename starts with #

You probably need to adjust the .htaccess file in your "/pub" directory to allow files ending with "mobi". Handling for files ending with "mobi" are not included in the default installation.

EDIT: Ajeh you are just too fast! ;)

28 Nov 2012, 8:44 PM
#4
scully avatar

scully

Zen Follower

Join Date:
Dec 2010
Posts:
257
Plugin Contributions:
0

Re: Problem Downloading products whose filename starts with #

Lhungil, thank you for telling me where to find the correct version of .htaccess...I freaked when I looked at the one in the root directory and it was empty! LOL

It says <FilesMatch ".*.(zip|ZIP|gzip|pdf|PDF|mp3|MP3|swf|SWF|wma|WMA|wmv|WMV|wav|epub)$"> which I presume is the default setting. So I should just add |azw3|fb2|mobi| etc at the end of the line, before the end-parenthesis?

28 Nov 2012, 8:49 PM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Problem Downloading products whose filename starts with #

Be aware that there should be two lines with the similar details on them and both need the new extension(s) added to them ...

28 Nov 2012, 8:57 PM
#6
scully avatar

scully

Zen Follower

Join Date:
Dec 2010
Posts:
257
Plugin Contributions:
0

Re: Problem Downloading products whose filename starts with #

That did it...thank you both for your help!!!!!!!!!!!!!!!!!!!!!!!!!!! :hug: You guys ROCK!!!!!!!

28 Nov 2012, 11:02 PM
#7
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Problem Downloading products whose filename starts with #

Thanks for the update that your downloads are working now that you adjusted the .htaccess file to work with your extension(s) ... :smile:

3 Dec 2012, 12:46 AM
#8
scully avatar

scully

Zen Follower

Join Date:
Dec 2010
Posts:
257
Plugin Contributions:
0

Re: Problem Downloading products whose filename starts with #

I thought we had this problem licked, but it happened again today with a pdf file. :(

Per your instructions a few days ago, I modified the .htaccess file in both places, and uploaded it...and just to be sure, I included both |pdf| and |PDF| in the lists of acceptable formats. I didn't know if it was case-specific, so better safe than sorry. I've also verified that the pdf actually exists on the server, it's properly attributed on the Attributes screen, all the capitalization is exactly the same on the file name and the Attribute, etc. And yet, when the customer tried to download the pdf file, she got the following error, just like what was happening before:

Forbidden
You don't have permission to access /zencart/pub/.psqpkszbvdmeoise-1354495264/ on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

When I logged into her account using the Encrypted Master Password module, and tried to download it myself as a test, I got the same error.

Is it significant that the file name is not included in the error message? I noticed that it was the other day, when this first happened. The file name is #13-BestBuddies-Sinh,Becca.pdf.

I manually sent her a copy of the file, so the problem is solved for now...but I sure would like to figure out why this happened so that I can get it fixed before another person tries to order a book, and can't download it.

Thanks very much for your advice on this, it's greatly appreciated!!

3 Dec 2012, 1:05 AM
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Problem Downloading products whose filename starts with #

You are using special characters other than alpha, number, dash and underscore ...

Try changing the filename to not include the # and possibly the comma in the name ...

3 Dec 2012, 1:14 AM
#10
scully avatar

scully

Zen Follower

Join Date:
Dec 2010
Posts:
257
Plugin Contributions:
0

Re: Problem Downloading products whose filename starts with #

I was afraid that was the problem. sigh That's going to mean a ton of work, because all of her anthologies are numbered that way, and she has a couple hundred files that will need changing.

The commas don't seem to be causing any trouble, because every file has the author name listed that way, and they're all downloading just fine. This is the first anthology segment that's been purchased since I converted all her files to multiple formats...so that would explain why all the other stories have been working fine but this one didn't.

I can use Total Commander to quickly change all the file names on the server...is there a quick & easy way to do it on Zencart? A csv file or something along those lines that can be opened, edited, then re-uploaded that will make all the changes at once? fingers crossed

3 Dec 2012, 1:25 AM
#11
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Problem Downloading products whose filename starts with #

Do you have command line access to your server?

If not, can you speak to your hosting provider to see if you can get it, or ask them to run a quick rename on all the files in your /downloads from:
#something.pdf to sommething.pdf

3 Dec 2012, 1:32 AM
#12
scully avatar

scully

Zen Follower

Join Date:
Dec 2010
Posts:
257
Plugin Contributions:
0

Re: Problem Downloading products whose filename starts with #

Total Commander can do that with one push of a button. What I need is a way to change all the attribute files. There are 17 different download formats for each book. Will I have to go through and modify every file on the Attributes Controller screen manually, or is there a master file I can download and modify that will change all of them easily, in one step?

3 Dec 2012, 1:43 AM
#13
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Problem Downloading products whose filename starts with #

For the Product Download database use:

UPDATE products_attributes_download SET products_attributes_filename = replace(products_attributes_filename,substring(products_attributes_filename,1,1),'') WHERE products_attributes_filename LIKE '#%';

For the Orders Product Download database use:

UPDATE orders_products_download SET orders_products_filename = replace(orders_products_filename,substring(orders_products_filename,1,1),'') WHERE orders_products_filename LIKE '#%';

NOTE: Backup your database first ...

NOTE: This will remove ALL # from the FILENAME that starts with a # ...

NOTE: To remove ALL # from anywhere in the FILENAME just remove the WHERE from each (which is what I would do and have your hosting provider remove the # anywhere in the filenames)

3 Dec 2012, 1:54 AM
#14
scully avatar

scully

Zen Follower

Join Date:
Dec 2010
Posts:
257
Plugin Contributions:
0

Re: Problem Downloading products whose filename starts with #

sigh I have no idea what any of that means. Not your fault--I just don't get it, even after reading it over several times.

I think it'll be a whole lot less stressful just to go through and manually change the 300+ files. :( I hate php...

Well, thanks anyway.

3 Dec 2012, 2:05 AM
#15
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Problem Downloading products whose filename starts with #

The idea is, to replace all of the filenames in both the tables:
products_attributes_download
orders_products_download

that have the # in the first letter of the filename ...

You can use the two SQL lines to do that replace for you in the database tables ...

You still need the filenames in the:
/download

to be fixed ...

Your hosting provider should be able to run a renaming of the files for you to fix these ...

In testing just now, I found the # anywhere in the filename will cause issues so the commands I posted are fine to fix these ...

Once your database tables are fixed and the filenames in /download are fixed you can test your download names in your Zen Cart Admin for a qucik confirmation that the filenames are correct on all of your Attributes in the Catalog ... Download Manager ... to ensure they all have the green dot next to them ...

3 Dec 2012, 2:06 AM
#16
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Problem Downloading products whose filename starts with #

NOTE: the SQL commands that I posted can be run in the Tools ... Install SQL Patches ... or via phpMyAdmin ...

3 Dec 2012, 12:45 PM
#17
scully avatar

scully

Zen Follower

Join Date:
Dec 2010
Posts:
257
Plugin Contributions:
0

Re: Problem Downloading products whose filename starts with #

Where do I find these tables? I downloaded the entire shopping cart to my PC so I could search for the proper files, but I couldn't find them anywhere.

3 Dec 2012, 2:54 PM
#18
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Problem Downloading products whose filename starts with #

The tables are part of your database ... these are not in the files on your server but accessed through your Control Panel for your domain via phpMyAdmin ...

You have files on your server in the /download directory ... those files are then referenced in the two tables of the database and need to have the new names for the files updated on your attributes in the table:
products_attributes_download

If any Orders were made with these files, then the table:
orders_products_download

would need to be updated as well ...

If you are able to get your hosting provider to update the filenames on the server by removing the # at the beginning of the filename, so that you do not have to manually fix each Attribute, you can use the SQL commands that I gave you ...

Otherwise, you will need to manually fix the filenames on the server and manually fix each of the Attributes with the new filename ...

3 Dec 2012, 3:15 PM
#19
scully avatar

scully

Zen Follower

Join Date:
Dec 2010
Posts:
257
Plugin Contributions:
0

Re: Problem Downloading products whose filename starts with #

I already changed all the file names on the server...Total Commander did that with a single command. Now I just need to fight my way through the stuff you just said above. I have no idea what I'm doing...I'm an html-web designer and don't understand php at all...so I'm really dreading this.

3 Dec 2012, 3:26 PM
#20
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Problem Downloading products whose filename starts with #

Okay, let's take this slow ...

When you change the filenames on the server, did you just remove the # from the first character of the filename?

Do you have any Orders made with these old filenames that had the # in the first character?