我正在做一个简单的缩略图生成器,生成缩略图没问题,我使用PHP,file_get_contents来获取删除图像内容。
我想知道下载这样的文件内容是否存在安全问题(使用cURL或file_get_contents)。
由于
答案 0 :(得分:0)
这是我要测试的一段代码:
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"
});