Summary of web file upload (1)

When using form tags in HTML files, you need to pay attention to the name attribute value myfile whose type is file in the input . PHP uses the name attribute value to distinguish the uploaded file information.

   1: Form

     method="post " post upload data (2MB)

     enctype="multipart/form-data" converts uploaded data to binary

     <input type="file" name="myfile" />

   2:php

    $_FILES saves all information about uploaded files

    $_FILES[" myfile "]["name"]; upload file kaola.jpg

    $_FILES["myfile"]["tmp_name"]; upload temporary file name

    $_FILES["myfile"]["type"]; upload file type image/gif

    $_FILES["myfile"]["size"]; upload file size

    move_uploaded_file(temp file, new file)

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324981596&siteId=291194637