Unable to calculate the number of uploaded files

Source: Internet
Author: User
Unable to calculate the number of uploaded files
Just copied a section of JavaScript that adds a text box node
But now the appearance of a click "Add another", will add a new Node
I added Echo ' Count (($_files[' img ' [' name ']) to the code after the submission;

Added two files, print out 1, how did not calculate it?

Share to:


------Solution--------------------
Which value is 1, it is recommended to post the code for analysis.
------Solution--------------------
Let's print the next $_files and look at it!
------Solution--------------------
This is your initial control.
img[] "/>

This is the control you attached
Input.setattribute (' name ', ' files[] ');//Set the input node Name property to files[], passed to the server side as an array

This is the control you're dealing with.
$num =count (($_files[' img' [' name '])); Calculate the number of uploaded files

It should be clear, right? A little more careful.

  • 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.