Jump to content

Large file upload/download issue


Recommended Posts

I know problems similar to this have threads across the forum... and I have read all of them! I am uploading downloadbale products to my website www.buymagazinearticles.co.uk/test and the file sizes range from a few K to 150MB. I am using Prestashop 1.3.1.1

I changed the settings in my php.ini file to:

upload_max_filesize = 200M ;
post_max_size = 10M ;
max_execution_time = 2400 ;
memory_limit = 200M



I wasn't sure where to put it so I put it in the root of the shop and in the admin folder.

I have been using a workaround that somebody provided on another post and that has been kind of working although not consistently... this got around the issue of not being able to upload large files.

However, when I went to download the files to test them, they wouldn't work. So I looked again... this time, I found a revised get-file.php file which I used to replace the one that was already on the site... problem solved. No issue! I was uploading and downloading 150M files, no problem.

Now, for some reason unbeknownst to me, I am now unable to upload even 20MB files! Well, I can upload them, but even using the workaround, I can't get them to attach to the relevant products.

Somebody on another post suggested adding the following five lines to the .htaccess file in the root of the shop and in the downloads folder:

# Max size upload file
php_value upload_max_filesize 200M
php_value post_max_size 200M
php_value max_execution_time 2400
php_value max_input_time 2400



But it doesn't seem to have made any difference. I am truly tearing my hair out and am willing to pay someone to sort this out for me if I can't find the answer elsewhere.

Please help me out if you can :) The support on this forum has been amazing so far and apart from this issue I'm extremely happy with Prestashop as an E-Commerce platform. I have attached my get-file.php for reference.

Thanks,

Samantha

BTW... this is the last entry in my error log:

[Wed Dec 01 13:57:21 2010] [error] [client 82.47.220.60] PHP Fatal error: Out of memory (allocated 3407872) (tried to allocate 23904257 bytes) in /home/sites/buymagazinearticles.co.uk/public_html/test/get-file.php on line 339, referer: http://www.buymagazinearticles.co.uk/test/admin123/index.php?tab=AdminCatalog&id_category=5&id_product=108&updateproduct;&token;=215f627eac9f20d026a418d3bf3166df

And this is a PHP Check http://www.buymagazinearticles.co.uk/test/phpcheck.php

get-file.php

Link to comment
Share on other sites

After a bit more messing about, I have successfully managed to prevent myself from being able to download any products at all. Good times.

EDIT

Have undone this disaster and am now left with the original issue. Just don't get why this is working for some files nad not others!

Link to comment
Share on other sites

you generally need about 2.5 times more RAM than the files you need to download, that may be the issue.
Also, some server require a php.ini in each folder, and for any backoffice / modules, you should place the php.ini in your admin folder.

Edit: also, if you are trying to use large files, this module will make your life easier :)http://www.prestashop.com/forums/viewthread/53511/

Link to comment
Share on other sites

Thanks for your response. I am using that module and it does make things easier. Not really getting around this issue though :( Have just tried to upload a file of a larger size than the ones I have previously been trying to upload that I knew had already worked before. It uploaded and downloaded fine with no issues at all.

It seems to be file-specific rather than related to anything else. This is so confusing!

Link to comment
Share on other sites

  • 2 weeks later...
  • 4 months later...
  • 3 months later...

If you're getting errors similar to digtheweb:

 

[Wed Dec 01 13:57:21 2010] [error] [client xxx.xxx.xxx.xxx] PHP Fatal error: Out of memory (allocated 3407872) (tried to allocate 23904257 bytes) in <dir>/public_html/test/get-file.php on line 339, referer: blah, blah, blah

 

This is due to the amount of memory a process can use which is also set in php.ini (or modified in .htaccess). Many shared hosting configurations limit this amount to prevent individual sites swamping the server (when real physical memory is exhausted, then the slow disk-based swap space is used).

 

You can try and increase this limit, but in many cases you won't be able to beyond the maximum allowed by the server's php configuration e.g. in .htaccess

php_value memory_limit 512M

 

If you can't increase this value high enough to prevent your issues (which I suspect is the case for digtheweb), then, unfortunately you'll have to look at an alternative method to distribute the files or change hosting.

 

You can save a little php script on your server called e.g. phpinfo.php containing the following:

 

<?php
phpinfo();
?>

 

If you browse to the above script it will show you all the current active (local - i.e. the values that apply currently by default for scripts) and "master" values for the various variables (under PHP Configuration, PHP Core). You might find that no matter what you have entered in your .htaccess file, you will be unable to increase the value beyond a certain point.

 

Paul

Link to comment
Share on other sites

  • 3 months later...

HELP PLS

 

I uploaded small file through product creation (.xlsx), it created no extension file in the download directory.

Then I uploaded large file through ftp (.csv)

Then I renamed large file with the name generated by presta, without extension. Then I tried to download through the store and it told me: file extension is invalid or file is corrupted.

Then I tried to rename with extensions (.csv and .xlsx) and it could not find the file.

 

what to do ?

Link to comment
Share on other sites

I think you need to zip your file and then do the trick again.

 

Im quite sure that prestashop by default is compressing the digital files as zip files so you need to zip your files and change the file name to the generated file name without the extension added.

  • Like 1
Link to comment
Share on other sites

  • 6 months later...
  • 3 years later...

Hi guys,

I got a similar problem in uploading theme. After spending 15-16 hours, here is the solution I've found:


1. edit prestashop settings: administration>preferences , increase values at "upload quota" block
2. update php.ini file:
    2.1 how to find the location of php.ini file: https://www.ostraining.com/blog/coding/phpini-file/
    2.2 update these values in php.ini  (max_input_time 3200 | post_max_size 32M | upload_max_filesize 32M | max_execution_time 300) https://cloud.digitalocean.com/support/suggestions?article=how-to-change-your-php-settings-on-ubuntu-14-04&page=0&query=upload_max_filesize
3. restart php and nginx services: (in linux with these commands: "service nginx restart" "service php5-fpm restart")
4. increase client_max_body_size of nginx. ( http://stackoverflow.com/questions/2056124/nginx-client-max-body-size-has-no-effect )


4th item of the list is not written in anywhere in prestashop forums and many people who cant find a solution especially vps users may need that.

I hope it works for you too. 


Cheers,
Ali

Edited by alikasapoglu (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...