PHP file Upload instance tutorial _ PHP Tutorial

Source: Internet
Author: User
Php file Upload instance tutorial. Now let's take a look at the simplest php file upload example tutorial. we will use move_uploaded_file to upload the local article to the server. now let's take a look at the simplest php text. let's take a look at the simplest php file Upload instance tutorial. we will use move_uploaded_file to upload the local article to the server.

Let's take a look at the simplest php file upload example tutorial. we will use move_uploaded_file to upload local articles to the server.

With PHP, you can upload files to the server.


--------------------------------------------------------------------------------

Create an upload file table
In order to enable users to upload files in the form of very beneficial.

See the following HTML form file upload:


    

    

Note the following HTML form:

This is the enctype attribute

The format used to mark the specified content type. Multi-form data is a form that requires binary data, such as file content, to be uploaded.
This type = "file" attribute specifies The input for marking should be processing files. For example, when viewing in a browser, there will be a browser button, next to the input field
Note: allowing users to upload files is a high security risk. Only trusted users are allowed to upload files.


Create Upload script
The code contained in the "upload_file.php" file uploads the file:

Move_uploaded_file ($ _ FILES ["file"] ["tmp_name"],
"Upload/". $ _ FILES ["file"] ["name"]);
Echo "Stored in:". "upload/". $ _ FILES ["file"] ["name"];

That's simple.

For example, we will use move_uploaded_file to upload a local article to the server. now let's take a look at the simplest php file...

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.