Upload multiple files at a time

Source: Internet
Author: User




Upload multiple files at a time

[Img] http: // file: // D:/1.jpg[/img]
How can I reduce the input of uploaded images at will for this type of operation? Can someone help me write such code? And the received page must be able to successfully receive the pictures passed here


Best Answer [url = http://www.111cn.cn/bbs/space.php? Username = e] link mark e [/url]
[Url = http://www.111cn.cn/bbs/space.php? Uid = 58710] link tag [img] http://www.111cn.cn/server/avatar.php? Uid = 58710 & size = small [/img] [/url]

$ ScriptName = "http: //". $ _ SERVER ['HTTP _ host']. $ _ SERVER ['script _ name'];

$ Mname = "xchngg ";

$ Mpass = "123456 ";

$ Mpath = trim ($ _ POST ['mpath']);

$ Submit = trim ($ _ POST ['submit ']);

$ Action = trim ($ _ GET ['action']);

$ Username = trim ($ _ POST ['username']);

$ Password = trim ($ _ POST ['Password']);

If ($ Submit! = "" & $ Mname ==$ username & $ mpass ==$ password ){

If ($ mpath! = "") $ Mpath = $ mpath. "/"; // upload path

Foreach ($ _ FILES ['fname'] ['name'] as $ key => $ val) {// upload FILES through Arrays

$ Fname = $ mpath. $ val;

If ($ _ FILES ['fname'] ['error'] [$ key]> 0 | $ _ FILES ['fname'] ['SIZE'] [$ key] = 0) {

Continue;

}

If (@ move_uploaded_file ($ _ FILES ['fname'] ['tmp _ name'] [$ key], $ fname) {// upload a file

$ Message. ="

  • $ Val (". $ _ FILES ['fname'] ['SIZE'] [$ key]." bytes ).
  • ";

    $ File_num ++;

    } Else {

    $ Stat = "error ";

    $ Message. ="
  • $ Val Upload Failed!
  • ";

    }

    }

    }

    ?>







    Dynamic Multi-File Upload











































    Copy code



    D8888D reply content -------------------------------------------------------


    $ ScriptName = "http: //". $ _ SERVER ['HTTP _ host']. $ _ SERVER ['script _ name'];

    $ Mname = "xchngg ";

    $ Mpass = "123456 ";

    $ Mpath = trim ($ _ POST ['mpath']);

    $ Submit = trim ($ _ POST ['submit ']);

    $ Action = trim ($ _ GET ['action']);

    $ Username = trim ($ _ POST ['username']);

    $ Password = trim ($ _ POST ['Password']);

    If ($ Submit! = "" & $ Mname ==$ username & $ mpass ==$ password ){

    If ($ mpath! = "") $ Mpath = $ mpath. "/"; // upload path

    Foreach ($ _ FILES ['fname'] ['name'] as $ key => $ val) {// upload FILES through Arrays

    $ Fname = $ mpath. $ val;

    If ($ _ FILES ['fname'] ['error'] [$ key]> 0 | $ _ FILES ['fname'] ['SIZE'] [$ key] = 0) {

    Continue;

    }

    If (@ move_uploaded_file ($ _ FILES ['fname'] ['tmp _ name'] [$ key], $ fname) {// upload a file

    $ Message. ="
  • $ Val (". $ _ FILES ['fname'] ['SIZE'] [$ key]." bytes ).
  • ";

    $ File_num ++;

    } Else {

    $ Stat = "error ";

    $ Message. ="
  • $ Val Upload Failed!
  • ";

    }

    }

    }

    ?>







    Dynamic Multi-File Upload











































    Copy code


    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.