Monday, November 29, 2010

How: download multiple images in PHP

The programming of your website in PHP, a dynamic environment to create you where your users interact with you, and help who want Web site.

To do this a PHP Web form is to create, which allows the user to download multiple files on your Web server. It is a basic PHP function that takes a few minutes in the program. Decide what types of files that you want to add the function visitors to your site and download of the page on your site where you want. Level of difficulty: Moderately easy

Instructions
  1. 1

    Select a Web page on your site, where users upload can see multiple files, or create a new page form that can only you use in the backend of the site.

  • 2

    Open the page in a text editor or a Web creation tool such as Notepad or Dreamweaver.

  • 3

    Type in the HTML code for the form.

  • The form works like the user interface to download files. The code should look like this:



    < html >.

    < body >

    < form action = "" method = "Show" enctype = "Multipart/form-data" >

    < p > download files:

    < input type = "File" name = "the file []" / >

    < input type = "File" name = "the file []" / >

    < input type = "File" name = "the file []" / >

    < input type = "submit" value = "Send" / >

    < /p >

    "< / form >".



    This form has three select locations for the files you want to download. If you download files from more than three, enter in the "< input type = file name [file] / >" "Line to another upload Add." Type niNE in quotation marks to the first and the last line of code.
  • 4

    Type PHP code that handles the uploaded files.

  • In this code are uploaded files in the same directory as the form.



    "<?" PHP

    / > foreach ($ _FILES ["file"] ["error"] as key $ = > $error) {}

    If (error $ == UPLOAD_ERR_OK) {}

    Echo "$ Error_codes [error$]".

    (Move_uploaded_file)

    $_FILES ["file"] ["Tmp_name"] [$ key];

    $_FILES ["file"] ["name"] [$ key]

    ) or die ("download problems").

    }

    }

    ? >

    < / body >

    < / html >.



    Use quotation marks to the first and the last line. Save the file and upload to your server.
  • 5

    Test the form by entering the full address of the form in your Web browser.

  • "Select files to upload from your computer, a file for each field and then click the button send" "."

    No comments:

    Post a Comment