Shopping Basket


Cart empty

Log In

Find Us Elsewhere


Forum Search


Files downloading with 0 bytes

3 months 4 days ago #3955 by iMbroidr
Things have been cooking along smoothly until the most recent products were added. When I place a test order, the files download but have 0 bytes.

I can see that the media files are all "for sale" marked "published" and in the vmfiles directory. I can see that the links are all listed properly in the product's custom fields list. If I copy the product files directly from the server back to the local hard drive, they all unzip properly.

I have replaced all the files and it's still not working.

What happened and how do I correct this?

TIA - Lindee

Please Log in or Create an account to join the conversation.

3 months 3 days ago #3956 by boggler

What happened and how do I correct this?

Unfortunately I am not gifted with psychic powers that allow me to know what has happened to other peoples' websites - it would be very useful if I were.

What I suggest is that you try turning on error reporting in your Joomla configuration, set the level to maximum and then try to download. What you will probably get is a small file of a few bytes which you can open with a text editor, it should contain an error message which will tell you what the issue is. Then turn off the error reporting again.

The issue will almost certainly be that the file cannot be found or cannot be opened. I am not sure what you mean when you say that the files are in the vmfiles directory. The files should be in your 'safe' directory as defined in your Virtuemart configuration. The file URL for the corresponding entry should be the complete path to the file, you can check this by going to Shop->Media Files and clicking on an entry, the Used url for the file must be the correct physical path to the file, eg something like this

If the used URL is incorrect the download will fail because this is what is used to find the file to download.

If this is not the issue, check that there is not a PHP open_basedir restriction preventing access to the file. If there is then you will need to make sure that the downloads folder is within the allowed path, you may need to get help from your web host to deal with this.

Please Log in or Create an account to join the conversation.

2 months 3 weeks ago #3960 by iMbroidr
So here's some more information on this problem. I can correct it by MANUALLY by opening the media item and doing a replace. The path is exactly the same as it was before and I can see via FTP that the file is replaced in vmfiles on the server. Even if I do a "Synchronize Media" it does not correct the problem, only a manual replace works.

So… files are only correctly downloaded via your plugin if I manually create each new media item.

Now the problem is HUGE because I've moved my site to a new hosting provider and now NONE of the files will download unless I do the manual replace on EACH file. (2iK files at this point)

None of the product IDs have changed. If I open a product, I can see that the downloads are all attached (see attached image). I have updated the safe files path in the configuration and the media files show that path.

It appears that some how the link is not being updated in the plugin even though it's still connected.

I've tried various ways of correcting this such as re-uploading the product data with the custom fields. With the pick list format used by the plugin, it's just impossible to reselect the files that way with the number of files I have. It takes 2 minutes to open a product that has downloads connected to it.

Doesn't the plug in link to the product ID which should then link to the path in the Media Manager?

What do you do when you have to move a site to new hosting service? Or you upgrade and move to a dedicated server? How are people handling mass additions of new downloadable products without manually tweaking each one?

Any ideas on how to correct this problem?


Please Log in or Create an account to join the conversation.

2 months 3 weeks ago - 2 months 3 weeks ago #3961 by boggler

I've moved my site to a new hosting provider

Ah, this is the vital information that you missed out before, it would have helped if you had mentioned this.

This is a problem with the file_url field being incorrect in the virtuemart_medias table in the database. This is the database field that stores the physical location of the file. When you go to download a file, the information that the plugin knows is the id number of the record in the Virtuemart medias table for that file, it uses that to look up the location of the file and then download it. If the file_url is wrong then it cannot download it because it cannot find the file.

When you move to a new hosting provider the location of the file will change, because different hosts will normally have a different organisation of the sites on their server. What you need to do is to update the Virtuemart medias table in your database so that the file_url field field shows the correct path. It is actually not hard to do, you could write a simple PHP script to do this.

Alternatively you can do this with a simple text editor. Make a backup of your database first. Use the database admin to download the sql for the virtuemart_medias table. You can open it in a text editor such as notepad. Do a search and replace so that the file path for the old server is replaced with that for the new server.

Then you can import the edited SQL for the table.

Please Log in or Create an account to join the conversation.

2 months 3 weeks ago #3962 by iMbroidr
Thanks. I'll look into that.

The hosting techs were working on this and here's the rely I got back from this this morning:

We've found out that the problem was related to VirtuMart third party extension keeping its media files absolute paths in the database (screenshot attached).

We've run a query to update this information in your database (screenshot also attached), but please note that this is a third party issue and we really went beyond our support policies here and this problem with VirtueMart will happen every time you change your site path (on migration to another hosting, on replication to another site on our servers also).

Please Log in or Create an account to join the conversation.

2 months 3 weeks ago #3963 by boggler
Yes it is what I said. It sounds like they have fixed this for you.

Please Log in or Create an account to join the conversation.

Moderators: boggler
Time to create page: 0.275 seconds