I'm unable to use the code snippet below for a file download on a site as readfile is disabled for security reasons, I'm told cURL can be used, any advice on how to change it or on the below replacement would be great, thanks.
Is there any issues with using this code as a replacement or anything I should be aware of?
PHP:
header('Content-type: '.$contentType);
header('Content-Disposition: attachment; filename="'.$filename.'"');
header('Content-length: '.$filesize);
readfile($file);
Is there any issues with using this code as a replacement or anything I should be aware of?
PHP:
$url = $file;
$path = $file;
$fp = fopen($path, 'w');
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_FILE, $fp);
$data = curl_exec($ch);
curl_close($ch);
fclose($fp);