[Skip to main content](#vessel-content)

#   Downloading big files fails

##

- **[121261](/forum/user/26582-121261 "View 121261's Profile")**
- [![121261's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/26582-121261 "View 121261's Profile") Topic Author
- [ Offline](/forum/user/26582-121261)

Less More

- Posts: 78
- Thank you received: 0
-
-

11 years 11 months ago [\#182168](#182168) by [121261](/forum/user/26582-121261 "View 121261's Profile")  *[Downloading big files fails](/forum/28-shipping-methods/873440-downloading-big-files-fails#182168 "-- HikaShop version -- : 2.3.4 -- Joomla version -- : 3.3.6  Hi there we have very big files for download and the downloads breaks halfway. In that regard PHP download method is not the best way to handle big files.  Can hikashop make use of Apache&#96;s X-Sendfile; its the most reliable method. Apache serves the download giving you the best performance. Files are also protected by a .htaccess file making this method secure.  Or what about Amazon S3 or Cloud download services.  Please advise  regards Bison")* was created by *[121261](/forum/user/26582-121261 "View 121261's Profile")*

-- HikaShop version -- : 2.3.4
-- Joomla version -- : 3.3.6

Hi there
we have very big files for download and the downloads breaks halfway.
In that regard PHP download method is not the best way to handle big files.

Can hikashop make use of Apache&#96;s X-Sendfile; its the most reliable method. Apache serves the download giving you the best performance. Files are also protected by a .htaccess file making this method secure.

Or what about Amazon S3 or Cloud download services.

Please advise

regards
Bison

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI4LXNoaXBwaW5nLW1ldGhvZHMvODczNDQwLWRvd25sb2FkaW5nLWJpZy1maWxlcy1mYWlscz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86555
- Thank you received: 14304
-
-

11 years 11 months ago [\#182175](#182175) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Downloading big files fails](/forum/28-shipping-methods/873440-downloading-big-files-fails#182175 "-- HikaShop version -- : 2.3.4 -- Joomla version -- : 3.3.6  Hi there we have very big files for download and the downloads breaks halfway. In that regard PHP download method is not the best way to handle big files.  Can hikashop make use of Apache&#96;s X-Sendfile; its the most reliable method. Apache serves the download giving you the best performance. Files are also protected by a .htaccess file making this method secure.  Or what about Amazon S3 or Cloud download services.  Please advise  regards Bison")*

Hi,

I actually had never heard of X-Sendfile until today.
That's a really good idea and easy to implement.
Add the code: Code:

if(function_exists('apache_get_modules')){ $modules = apache_get_modules(); if (is_array($modules) &amp;&amp; count($modules) &amp;&amp; in_array('mod_xsendfile', $modules)) { // If mod_xsendfile is loaded, use X-Sendfile to deliver... header("Expires: 0"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename="' . $name . '"'); header("Cache-Control: maxage=1"); header("Pragma: public"); header("Content-Transfer-Encoding: binary"); header('X-Sendfile: ' . $filename); $dispatcher-&gt;trigger( 'onAfterDownloadFile', array( &amp;$filename, &amp;$file) ); exit; } }

after the code: Code:

$name = (strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE')) ? preg_replace('/\./', '%2e', $fileinfo['basename'], substr_count($fileinfo['basename'], '.') - 1) : $fileinfo['basename'];

in the file administrator/components/com_hikashop/classes/file.php and if you have mod_xsendfile configured on your web server, it will use it to send the files. Please note that this requires that mod_xsendfile is installed and correctly configured to allow the sending of the files from the upload secure folder of HikaShop (default location is media/com_hikashop/upload/safe), otherwise, it will use the normal send process or not send anything.

Please let us know how it goes so that we can add it to next version of HikaShop.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI4LXNoaXBwaW5nLW1ldGhvZHMvODczNDQwLWRvd25sb2FkaW5nLWJpZy1maWxlcy1mYWlscz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86555
- Thank you received: 14304
-
-

11 years 7 months ago [\#197293](#197293) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Downloading big files fails](/forum/28-shipping-methods/873440-downloading-big-files-fails#197293 "-- HikaShop version -- : 2.3.4 -- Joomla version -- : 3.3.6  Hi there we have very big files for download and the downloads breaks halfway. In that regard PHP download method is not the best way to handle big files.  Can hikashop make use of Apache&#96;s X-Sendfile; its the most reliable method. Apache serves the download giving you the best performance. Files are also protected by a .htaccess file making this method secure.  Or what about Amazon S3 or Cloud download services.  Please advise  regards Bison")*

This was added in HikaShop 2.3.5

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI4LXNoaXBwaW5nLW1ldGhvZHMvODczNDQwLWRvd25sb2FkaW5nLWJpZy1maWxlcy1mYWlscz90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.052 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
