Secure PHP Image Uploader

来源:互联网 发布:mac制作win10启动盘 编辑:程序博客网 时间:2024/06/05 08:36

About

I put together this class to act as a one step, no hassle image processor for file uploads. After searching the web for a short while trying to find something which would not only check the errors HTML returns, but also deal with security vulnerabilities and resize the image, I eventually decided it would be easier for me to build one myself. And now that I have it working and fairly secure, I've decided to release it for anyone's use. I've tried to address all the security concerns I can think of, but if anyone spots any other security holes, please do let me know.

Instructions

After including ImgUploader.class.php (found in the download at the bottom of the page) you simply construct an instance of the class for each image you're uploading, and then call upload() or upload_unscaled() for each location you want to save the image to. More detailed instructions can also be found in the zip file.

include 'imgUploader.class.php'; $img = new ImgUploader($_FILES['file']); if($name = $img->upload('green', '113', 400,400)) echo '<img src="'.$name.'" alt="name" />'; else echo 'ERROR! '.$img->getError();

Download: Zip Archive
Size: 3.06kb

anoTher:http://www.0x000000.com/index.php?!=1&read=80|3

 
原创粉丝点击