Reputation: 22711
I am doing a simple thumbnail generator, no problem to generate the thumbnail, I am using PHP, file_get_contents to get the remove image content.
I am wondering if there is some security issue to download the file content like this (with cURL or file_get_contents).
Thanks
Upvotes: 0
Views: 217
Reputation: 22711
Here a piece of code I will test:
curl_setopt($cURL_Handle, CURLOPT_BUFFERSIZE, 128);
curl_setopt($cURL_Handle, CURLOPT_NOPROGRESS, false);
curl_setopt($cURL_Handle, CURLOPT_PROGRESSFUNCTION, function(
$DownloadSize, $Downloaded, $UploadSize, $Uploaded) {
// If $Downloaded exceeds 1KB, returning non-0 breaks the connection!
return ($Downloaded > (1 * 1024)) ? 1 : 0;
});
curl_setopt($cURL_Handle, CURLOPT_WRITEFUNCTION, function(
$ch, $str) {
// Grab the first bytes, check if match a image "header signature"
});
Upvotes: 0