In this paper, we describe the path of uploading images in PHP and how to assign values to form fields. Share to everyone for your reference, as follows:
1. Invocation Method Example:
Large Map Path:
Small map Path:
2. uppic.php
<?phpheader ("content-type:text/html;charset=gb2312");? ><title>Image upload</title>
<?php$id=$_get["id"];//echo "id==". $id; switch ($_get["action"]) {case ' up ': Upmovie ($id); Break;default:upinput ($ ID); break;} function Upinput ($id) {?><?php}function Upmovie ($id) {global $web _picdir; $savePath =dirname (__file__). " /". $web _picdir; $str = Date (' Ymdhis '); if ($_files[' Strphoto ' [' Name ']!= ') {$tmp _file=$_files[' strphoto '] [' tmp_name ']; $file _types=explode (".", $_files[' Strphoto ' [' name ']); $file _type= $file _types[count ($file _types)-1]; if (Strtolower ($file _type)! = "JPG" &strtolower ($file _type)! = "gif" &strtolower ($file _type)! = "BMP" & Strtolower ($file _type)! = "png") {echo 'Format error Please re-upload"; Exit } $file _name= $str. ".". $file _type; if (!copy ($tmp _file, $savePath. $file _name)) {echo "upload error Please try again!! "; }else{//echo "Upload Successful"; echo "Upload Successful"; echo ""; }}else{echo "Please select the file you want to upload"; }}? >
Note: Different text boxes need to define ID, iframe url:uppic.php?id= text box ID
Read more about PHP picture operation related content readers can view this site topic: "PHP graphics and picture Operation Skills Summary"
I hope this article is helpful to you in PHP programming.
The above describes the PHP upload image acquisition path and to the form field assignment method, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.