I have some files living at Rackspace. To avoid filename collision, they are all renamed to an md5 hash of microtime(true), and the original file name is saved in the database.
When a user is to download one of these files, I need to:
1. serve the file straight from rackspace (they are huge).
2. Have the file pre-renamed back to the original file name so that when the user downloads it, it is transparent.
I have tried this:
/* Extract information from Rackspace */
$buffer = explode(":", $headers);
$content_length = trim($buffer);
$buffer = explode(":", $buffer);
$content_type = trim($buffer);
$resource = fopen($file_path,'rb');
/* Resend to user */
but it comes back with "File not found". However, when I do header("Location: $file_path") I get the files perfectly. (They are just named the hash, which is not nice ot the user).
What am I missing here?