• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
encrypt file upload - prompt user with original file name on download?

Let me start by saying that CI rocks! I've really enjoyed working with this well thought out framework.

I apologize if this has been posted before, but I was unable to find something relevant.

I'm using ['encrypt_name'] = TRUE; for a file upload.

I'm also storing the original file name in my database.

How can I prompt the user with the original file name when they try to download? I'd rather they not see the long, encrypted file name.

Thanks for any insight.

If your files are small use the download helper:
// get $data from db
$file_data = file_get_contents('/path/to/'.$data['encrypted_filename']);
force_download($data['plain_filename'], $file_data);

If your files are too big to fit in memory, use one of the code examples from here:
header('Content-Disposition: attachment; filename="'.$data['plain_filename'].'"');

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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