PHP upload image to get the path and the form field assignment method,
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 [back]"; Exit } $file _name= $str. ".". $file _type; if (!copy ($tmp _file, $savePath. $file _name)) {echo "upload error Please try again!! [Back]"; }else{//echo "Upload Successful"; echo "Upload Successful"; echo ", if you need to change, please re-upload"; }}else{echo "Please select the file you want to upload [back]"; }}? >
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.
Articles you may be interested in:
- PHP+HTML5 How to submit forms and upload pictures using Formdata objects
- Two methods for uploading images in PHP
- PHP+HTML5 implement no refresh picture upload Tutorial
- thinkphp implementation of image upload function
- PHP upload images generated thumbnails (GD library)
- How to implement PHP upload image and compress
- PHP implementation image upload and compression
- Php+ajax upload Image instance code without refresh
- How PHP modifies the upload image size
- PHP Upload image client and server-side implementation methods
- Php+jquery+ajax achieve multi-image upload effect
- PHP implementation of uploading images to the database method
- PHP Yii Framework's form validation rules Daquan
http://www.bkjia.com/PHPjc/1095280.html www.bkjia.com true http://www.bkjia.com/PHPjc/1095280.html techarticle PHP upload image to obtain the path and the form field assignment method, this article describes the PHP upload Image acquisition path and the method of assigning the form field. Share to everyone for reference, with ...