ما هو الخطا فى هذا الكود:
public function image($file, $path = "img/img_".date('Y-m-d-H-i-s').".png"){
file_put_contents($path, $file);
}
و سؤال أخر
كيف عندما اضغط على رابط (صورة) يقوم بعمل تحميل PHP
التعليق السابق
هذا كود يعمل لإجبار المتصفح على تحميل الصورة من السيرفر، قمت بإضافته إلى الدّالّة وتعديله حسب ما ترغب:
$file = 'C:\\test.jpg';
header('Cache-Control: public');
header('Content-Description: File Transfer');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Type: '.mime_content_type($file));
header('Content-Transfer-Encoding: binary');
header('Content-Length: '.filesize($file));
readfile($file);
التعليقات