The error location in pic2 shows the pic. php {code...} pic2.php {code ...}
The error location in pic2 is marked
Pic. php
ZwelL Image Upload Program
Pic2.php
File Name: ". $ destination_folder. $ fname ."
"; Echo" width: ". $ image_size [0]; echo" Length: ". $ image_size [1]; echo"
Size :". $ file ["size"]. "bytes"; if ($ watermark = 1) {$ iinfo = getimagesize ($ destination, $ iinfo); $ nimage = imagecreatetruecolor ($ image_size [0], $ image_size [1]); $ white = imagecolorallocate ($ nimage, 255,255,255); $ black = imagecolorallocate ($ nimage, 0, 0); $ red = imagecolorallocate ($ nimage,, 0, 0); imagefill ($ nimage, $ white); switch ($ iinfo [2]) {case 1: $ simage = imagecreatefromgif ($ destination); break; case 2: $ simage = imagecreatefromjpeg ($ destination); break; case 3: $ simage = imagecreatefrompng ($ destination); break; case 6: $ simage = imagecreatefromwbmp ($ destination ); break; default: die ("unsupported file types"); exit;} imagecopy ($ nimage, $ simage, 0, 0, 0, $ image_size [0], $ image_size [1]); imagefilledrectangle ($ nimage, 1, $ image_size [1]-15, 80, $ image_size [1], $ white); switch ($ watertype) {case 1: // Add the watermark string imagestring ($ nimage, 2, 3, $ image_size [1]-15, $ waterstring, $ black); break; case 2: // watermark image $ simage1 = imagecreatefromgif ("xplore.gif"); imagecopy ($ nimage, $ simage1,); imagedestroy ($ simage1); break ;} switch ($ iinfo [2]) {case 1: // imagegif ($ nimage, $ destination); imagejpeg ($ nimage, $ destination); break; case 2: imagejpeg ($ nimage, $ destination); break; case 3: imagepng ($ nimage, $ destination); break; case 6: imagewbmp ($ nimage, $ destination ); // imagejpeg ($ nimage, $ destination); break;} // overwrite the original uploaded file imagedestroy ($ nimage); imagedestroy ($ simage );} if ($ imgpreview = 1) {echo"
Image preview:
"; Echo" ";} header (" location: http: // localhost/pic. php ") ;}?>
Reply content:
The error location in pic2 is marked
Pic. php
ZwelL Image Upload Program
Pic2.php
File Name: ". $ destination_folder. $ fname ."
"; Echo" width: ". $ image_size [0]; echo" Length: ". $ image_size [1]; echo"
Size :". $ file ["size"]. "bytes"; if ($ watermark = 1) {$ iinfo = getimagesize ($ destination, $ iinfo); $ nimage = imagecreatetruecolor ($ image_size [0], $ image_size [1]); $ white = imagecolorallocate ($ nimage, 255,255,255); $ black = imagecolorallocate ($ nimage, 0, 0); $ red = imagecolorallocate ($ nimage,, 0, 0); imagefill ($ nimage, $ white); switch ($ iinfo [2]) {case 1: $ simage = imagecreatefromgif ($ destination); break; case 2: $ simage = imagecreatefromjpeg ($ destination); break; case 3: $ simage = imagecreatefrompng ($ destination); break; case 6: $ simage = imagecreatefromwbmp ($ destination ); break; default: die ("unsupported file types"); exit;} imagecopy ($ nimage, $ simage, 0, 0, 0, $ image_size [0], $ image_size [1]); imagefilledrectangle ($ nimage, 1, $ image_size [1]-15, 80, $ image_size [1], $ white); switch ($ watertype) {case 1: // Add the watermark string imagestring ($ nimage, 2, 3, $ image_size [1]-15, $ waterstring, $ black); break; case 2: // watermark image $ simage1 = imagecreatefromgif ("xplore.gif"); imagecopy ($ nimage, $ simage1,); imagedestroy ($ simage1); break ;} switch ($ iinfo [2]) {case 1: // imagegif ($ nimage, $ destination); imagejpeg ($ nimage, $ destination); break; case 2: imagejpeg ($ nimage, $ destination); break; case 3: imagepng ($ nimage, $ destination); break; case 6: imagewbmp ($ nimage, $ destination ); // imagejpeg ($ nimage, $ destination); break;} // overwrite the original uploaded file imagedestroy ($ nimage); imagedestroy ($ simage );} if ($ imgpreview = 1) {echo"
Image preview:
"; Echo" ";} header (" location: http: // localhost/pic. php ") ;}?>
You copied the Code directly, right,$max_file_size
Undefined, so any uploaded file will be blocked by this sentence.