• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to load files when stored OUTSIDE public folder

#6
[eluser]Jelmer[/eluser]
I use readfile() for this goal. I'm not entirely sure but I think it's more efficient. readfile() writes the file's contents directly to the output buffer while file_get_contents() first reads it into PHP and then has to write it through PHP. Which I'd guess is less efficient.

The same code using readfile():
Code:
$details = getimagesize($path . '/' .  $image);
header ('Content-Type: ' . $details['mime']);
readfile($path . '/'  . $image);
exit;


Messages In This Thread
How to load files when stored OUTSIDE public folder - by El Forum - 06-23-2010, 09:33 AM
How to load files when stored OUTSIDE public folder - by El Forum - 06-23-2010, 01:29 PM
How to load files when stored OUTSIDE public folder - by El Forum - 06-23-2010, 01:30 PM
How to load files when stored OUTSIDE public folder - by El Forum - 06-23-2010, 01:36 PM
How to load files when stored OUTSIDE public folder - by El Forum - 06-24-2010, 06:21 AM
How to load files when stored OUTSIDE public folder - by El Forum - 06-24-2010, 06:50 AM
How to load files when stored OUTSIDE public folder - by El Forum - 06-24-2010, 09:20 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.