First prev:
Create a form in sample6_1.php:
Copy the Code code as follows:
Show upload status and pictures
The upload file needs to be defined enctype, in order to show the image set target to Uploadframe
Upload Image function Uploadimg:
Copy the Code code as follows:
function Uploadimg (theform) {
Submit Form
Theform.submit ();
Show upload status in Showimg
SetStatus ("Loading ...", "showimg");
}
Upload status function
function SetStatus (thestatus, theobj) {
obj = document.getElementById (theobj);
if (obj) {
obj.innerhtml = "" + Thestatus + "";
}
}
process_upload.php provides file upload function:
Copy the Code code as follows:
Provides a picture type check
$allowedtypes = Array ("Image/jpeg", "Image/pjpeg", "Image/png", "Image/x-png", "image/gif");
File storage Directory
$savefolder = "Images";
If there's a file upload, start working.
if (Isset ($_files[' myfile ')) {
Check if the upload file conforms to the $allowedtypes type
if (In_array ($_files[' myfile ' [' type '], $allowedtypes)) {
if ($_files[' myfile ' [' error '] = = 0) {
$thefile = "$savefolder/". $_files[' myfile ' [' name '];
Uploading Files via Move_uploaded_file
if (!move_uploaded_file ($_files[' myfile ' [' tmp_name '], $thefile)) {
echo "There is an error uploading the file.";
}
else{
?>
"Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
"/>
}
}
}
}
?>
The Doneloading function in the last part of the code above is used to display the image and modify the size of the image. Which will be used to thumb.php, it will be in the images directory to generate the source image of the large, medium and small three size, interested can be studied. Welcome everyone to shoot bricks ~
Text Source package Download
The above describes the image processing software Photoshop ajax+php edge learning side of the five image processing, including the image processing software Photoshop content, I hope to be interested in PHP tutorial friends helpful.