Welcome Guest, Not a member yet? Register   Sign In
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



Theme © iAndrew 2016 - Forum software by © MyBB