[eluser]mci[/eluser]
Hi
I'm trying to write a function to download a file but I always get the error:
"A PHP Error was encountered
Severity: Warning
Message: file_get_contents(user_data/data.zip) [function.file-get-contents]: failed to open stream: No such file or directory
Filename: controllers/data.php
Line Number: 48
"
The "user_data" folder is in the root directory and upload is working.
Code:
function download($name)
{
$path_to_document = 'user_data/'.$name;
$data = file_get_contents($path_to_document);
$file_name = split('/', $path_to_document);
$size = sizeof($file_name);
$name = 'dl_' . url_title($name[$size - 1]);
force_download($name, $data);
}