[eluser]Daniel Cronin[/eluser]
Hi,
I'm trying to make a download for a secure file on amazon s3. I am using the amazon S3 CodeIgniter library and force download with no success.
Here's the code...
Code:
function index($file_id)
{
$this->load->helper('download');
$this->load->library('s3');
$this->db->where('id', $file_id);
$query = $this->db->get('Documents');
if($query->num_rows())
{
$file = $query->row_array();
$content = $this->s3->getObject('secretmethod', 'documents/'.$file['filename']);
force_download($file['filename'], $content);
}
else
{
echo 'File not found!';
}
}
Here's the error I'm getting... It actually just writes the errors to the file. (Side note, does anyone know how to stop the download on error?)
Code:
A PHP Error was encountered
Severity: 4096
Message: Object of class stdClass could not be converted to string
Filename: helpers/download_helper.php
Line Number: 91
A PHP Error was encountered
Severity: Notice
Message: Object of class stdClass to string conversion
Filename: helpers/download_helper.php
Line Number: 91
If you know a better way to do this, let me know. I just want to check that the user downloading is a member before downloading the file. Maybe a redirect would work?
Any help would be greatly appreciated!
Thanks!