PHP Upload Image Acquisition path and the method of assigning values to form fields

Source: Internet
Author: User
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.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.