Php image upload and storage source code and can be previewed. Copy the code as follows :? Phpheader (content-Type: texthtml; charsetgb2312); $ uptypesarray (imagejpg, List of uploaded file types imagejpeg, imagepng, imagepjpeg,
The code is as follows:
Header ("content-Type: text/html; charset = gb2312 ");
$ Uptypes = array ('image/jpg ', // list of uploaded File types
'Image/jpeg ',
'Image/png ',
'Image/pjpeg ',
'Image/GIF ',
'Image/bmp ',
'Application/x-shockwave-Flash ',
'Image/x-png ',
'Application/msword ',
'Audio/x-ms-wm ',
'Audio/MP3 ',
'Application/vnd. rn-realmedia ',
'Application/x-zip-compressed ',
'Application/octet-stream ');
$ Max_file_size = 10000000; // size limit of uploaded files, in bytes
$ Path_parts = pathinfo ($ _ SERVER ['php _ SELF ']); // Obtain the current path
$ Destination_folder = "up/"; // file Upload path
$ Watermark = 0; // whether to add a watermark. (1 indicates adding a watermark, and 0 indicates not adding a watermark );
$ Watertype = 1; // watermark type (1 is text, 2 is image)
$ Waterposition = 2; // watermark position (1 indicates the lower left corner, 2 indicates the lower right corner, 3 indicates the upper left corner, 4 indicates the upper right corner, and 5 indicates the center );
$ Waterstring = "www. yinao. tk"; // watermark string
$ Waterimg = "xplore.gif"; // watermark image
$ Imgpreview = 1; // whether to generate a preview image (1 is generated, 0 is not generated );
$ Imgpreviewsize = 1/1; // Thumbnail ratio
?>
Image upload and storage