prestondocks Posted January 22, 2010 Share Posted January 22, 2010 Hi,All the products in my store are downloadable. One is 130MB. My hosting provider has a max upload file size of 32MB for PHP. I can however upload any size I want from the admin interface of my hosting account. As my hosting provider uses CPanel I can not change the PHP settings.I tried to get around the problem, by creating a file with the same name and of the same type (.zip) as the 130MB file but just a few KB and uploading that. I tested this and it downloads fine. I then replaced the file keeping the same file name that was generated with the 130MB file.However this will not download.Should this have worked? if not is there another way around the PHP upload size restriction?ThanksSimon Link to comment Share on other sites More sharing options...
tomerg3 Posted January 22, 2010 Share Posted January 22, 2010 Yes there is, you can use ini_set();Try adding the following lines to a new php file first to see if it works (open it in your browser. <? ini_set('upload_max_filesize','150M'); ini_set('post_max_filesize','150M'); set_time_limit (3600); phpinfo(); ?> Scroll down to the line with upload_max_filesize and see if one of the values there is changed (one should be the default still at 32, and the other should show 150).It this works, copy those lines (except phpinfo()) to the top of /admin/adminCatalog.phpYou may also need to increate the values of these 2 lines in adminProduct.php (line18,19) protected $maxImageSize = 2000000; protected $maxFileSize = 10000000; Link to comment Share on other sites More sharing options...
drumslist Posted January 22, 2010 Share Posted January 22, 2010 I am also having an issue with downloadable products and file size. I found this thread here, but I will try the php script as just posted and follow up. --http://www.prestashop.com/forums/viewthread/35893/help_configuration___use/ problem_uploading_downloadable_files_exceeding_14mb_solved/ Link to comment Share on other sites More sharing options...
prestondocks Posted January 22, 2010 Author Share Posted January 22, 2010 Thanks for the response. I had a talk with my hosting provider and they told me to setup a php.ini file in the admin folder for prestashop. Any settings that I put in this file will override the primary PHP file. I have tried it and sure enough prestashop shows me that I can now upload up to 200MB. I have just tried uploading the 138MB file and that failed with "Big Error"I have also tried it with a 47MB file and still get a "Big Error"Any ideas what other PHP settings I may need to change.ThanksSimon Link to comment Share on other sites More sharing options...
tomerg3 Posted January 22, 2010 Share Posted January 22, 2010 I'm going to need more information than just Big Error... Link to comment Share on other sites More sharing options...
prestondocks Posted January 23, 2010 Author Share Posted January 23, 2010 I'm not getting the big error any more. By the way "Big Error" is the error message that prestashop gives you when you try to upload a file that is bigger than your PHP settings will allow.Everything seems to be working with the upload, but I get the following error when downloading from either the backend or frontend. It is as though prestashop is trying to display the file as a web page. I have tried right clicking and save link as. The save dialog box opens with the correct file name, but it just saves an empty file.The error message I'm getting isThis web page is not found.No web page was found for the web address: http://www.etech-training.co.uk/freepbxtrg/get-file.php?key=0fa6c45cec987e22d515a05feef9c6cb40ed3eba-b3118d3dc94a4121dec3cb10b2c5cb1ec7c54e69 More information on this errorI have also added a screen shot of the errorAny suggestions on what I might be doing wrong?ThanksSimon Link to comment Share on other sites More sharing options...
prestondocks Posted January 23, 2010 Author Share Posted January 23, 2010 Not sure if I have discovered a bug while trying to sort out this download issue.If I upload a MP3 or JPG image everything works fine and as expected.If I upload a .zip or a office .ods file prestashop downloads get-file-admin.php it seems it only works with popular file names and .zip is not one of them apparently.Is there is filter to only allow uploading and downloading of certain file types.ThanksSimon Link to comment Share on other sites More sharing options...
tomerg3 Posted January 23, 2010 Share Posted January 23, 2010 Is this only for large files?I have no problems with zip or .doc files, and I don't believe Prestashop has any restrictions on file extensions.Also, which version of Prestashop do you use? Link to comment Share on other sites More sharing options...
prestondocks Posted January 23, 2010 Author Share Posted January 23, 2010 I am 1.2.5 which I believe is the latest releaseI seem to have everything working now on smaller files even of type .zip but on big files prestashop still seems to treat them as a web page and says the page can not be found.ThanksSimon Link to comment Share on other sites More sharing options...
prestondocks Posted January 24, 2010 Author Share Posted January 24, 2010 OK, I have a solution(work around) to this issue of file size. It seems to be related to PHP not being able to handle such large files with the readfile() command, which is what prestashop uses to deliver the downloadable files.Create your product as normal and upload a small file of the same filename. (just open notepad and save an empty document with the file name and extension you want)you then need to edit get-file.phpAt the very end of the file comment out all the lines of code starting with header and enter this line insteadheader("location: http://www.yourserver.com/a_web_readable_folder_outside_of_the_prestashop_structure/" . $filename)Then you need to copy the file you want customers to be able to download to the folder you have created. Dont bother naming it with that great big hash file name that prestashop uses.Now when customers click to download a file, they will get the file from the folder you created. Dont worry they will not be able to see folder the file came from.Hope this helps someonePrestashop, can you look at this and try to include a fix that will allow the downloading of larger files.Thanks Link to comment Share on other sites More sharing options...
tomerg3 Posted January 25, 2010 Share Posted January 25, 2010 I will try to look into this and come up with a proper solution.Do you know at which point it stops working? Link to comment Share on other sites More sharing options...
tomerg3 Posted January 25, 2010 Share Posted January 25, 2010 OK, I think I have a solution for you, try adding the following line right before the readfile() call in get-file.php line #106 ob_end_flush() Let me know if it works.... Link to comment Share on other sites More sharing options...
prestondocks Posted January 25, 2010 Author Share Posted January 25, 2010 Thanks Tomerg,I have just tried adding ob_end_flush() and it works like a treat.If that could be incorporated into the next release it would be great.Thank youSimon Link to comment Share on other sites More sharing options...
tomerg3 Posted January 25, 2010 Share Posted January 25, 2010 Thanks Tomerg,I have just tried adding ob_end_flush() and it works like a treat.If that could be incorporated into the next release it would be great.Thank youSimon That's great, that command tell php not to load the entire file into memory, which was causing the problem...I am not a part of the Prestashop team, so the only thing I can do (much like everyone else) is submit a bug report, and include the solution. Link to comment Share on other sites More sharing options...
tsmorton Posted March 4, 2010 Share Posted March 4, 2010 The ob_end_flush() command is a great help. Fixed my download problems as well.Thanks! Link to comment Share on other sites More sharing options...
PS User Posted March 18, 2010 Share Posted March 18, 2010 Humm can this work with large file size such as standard 4.7G DVD size? I am thinking to use PresShop for my software business but after looking into such big issue it gives me a thought that this will be very unstable for file in such size... 4.7GB or beyond... blu-ray file size!!!Unlike ASPDotNetStoreFront, one of the best commercial software that will give you two choices, use upload funciton for smaller type file size, even though when theyd said "small" meaning it's up to 700MB (CD size)! Still overcome the limitation that lots of shopping cart has, and second choice is the "file-on-server" function, so for large file such as DVD, you can choose, and hit "convert" then the ASPDotnetStoreFront will convert file name into coding format without even "upload"ing!But ASPDotNetStoreFront is very very expensive, $1,400 US Dollars, guess because they have 120 paid team of programmers working around the clock in different countries and 6,000 developers partner with them sharing their lines of codes for any issues they might have, but I'm sure Prestashop should have some solution on this? Money shuld not be the issue how programming can be done, since I don't mind sharing mine, although some people won't agree with me lol...Anyway, any suggestions on how this can be done? Thank you in advance!! Link to comment Share on other sites More sharing options...
yvesbj Posted May 6, 2010 Share Posted May 6, 2010 Hi,Sorry for my English. (j'ai traduit avec Google Translate). Me, my clients must be able to transfer 300MB1 - I created a php.ini file with upload_max_filesize = 500M post_max_size = 500M set_time_limit = 9000 2 - I added this code in the file "config.inc.php" : @ini_set('upload_max_filesize', '500M'); @ini_set('post_max_filesize','500M'); @set_time_limit (9000); 3 - I try adding the following line right before the readfile() call in get-file.php line #106 : ob_end_flush() 4 -I added two lines in lines 9 and 10 of the file "adminproducts.php": protected $maxImageSize = 2000000; protected $maxFileSize = 10000000 I tried everything but it still does not work. The transfer works well below 2 MB. But when I try to upload a larger file that does not work Can you help me please ? Link to comment Share on other sites More sharing options...
astrolab Posted June 23, 2010 Share Posted June 23, 2010 OK, I think I have a solution for you, try adding the following line right before the readfile() call in get-file.php line #106ob_end_flush() Let me know if it works.... Hello Tomerg3,I would try your "ob_end_flush()" but, could you tell me please where exactly I have to place it?elseif (function_exists('mime_content_type')) $mime_type = @mime_content_type ($file); elseif (function_exists('exec')) $mime_type = trim(@exec('file -bi '.escapeshellarg($file))); Thank you very much by advance! That fix would help me a lot Link to comment Share on other sites More sharing options...
need4speed Posted December 14, 2010 Share Posted December 14, 2010 The line should look like this:ob_end_flush();readfile($file);exit;In the get-file.php fileBut its only fix the URL so you can download large files but when your trying to open the downloaded file its broken Link to comment Share on other sites More sharing options...
Tris Posted December 19, 2010 Share Posted December 19, 2010 ob_end_flush(); worked fine for me.Thanks a lot Tomerg3 Link to comment Share on other sites More sharing options...
need4speed Posted December 19, 2010 Share Posted December 19, 2010 Yeah it seems to work for me as well... Top dollar Tomerg3 Link to comment Share on other sites More sharing options...
juaneddyriquelme Posted September 1, 2012 Share Posted September 1, 2012 Hi guys. Finally solved (I hope). I tried the trick of renaming a file uploaded with FTP in the "download" folder, using the .rar compression instead of .zip. I also copied php.ini in the "admin" folder with max_file_size upgraded to (whatever extent you need). I tried the trick with .zip first, it downloaded a "corrupted file". Being stubborn, I started again with a different extension (.rar) and everything is fine. I've tried 13 downloads from different computers with different systems and different browsers; Everything's perfect. Thanks for you all your advice guys. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now