Counting # of uploads


#1

I have a form which allows an unlimited # of uploads,


Im trying to upload the three images on the bottom,
Heres the HTML for the image sefection button (which uses javascript to allow multiple files to be selected

<input type="file" id="picupload" class="picupload" click-type="type2" name="Images[]" accept="image/*" multiple />

But when the form is submitted, im trying to record all 3 of the images like

<?php


echo '<br>FILES[Images]: <pre>';print_r($_FILES['Images']);echo '</pre>';

if(isset($_FILES['Images']['name'][0])) {

  if($_FILES['Images']['name'][0] != '') {
			
  $images = $_FILES['Images'];
			
  $total = count($images['name']);
										
  echo 'Count: '.$total.'<br>';

?>

The result

FILES[Images]:

Array
(
    [name] => Array
        (
            [0] => 85535663.jpg
        )

    [type] => Array
        (
            [0] => image/jpeg
        )

    [tmp_name] => Array
        (
            [0] => /tmp/php78AyhG
        )

    [error] => Array
        (
            [0] => 0
        )

    [size] => Array
        (
            [0] => 113762
        )

)

Count: 1

Should all 3 be shown and the count be 3?


#2

It is working on my machine

Array
(
    [Images] => Array
        (
            [name] => Array
                (
                    [0] => LTE_4G.png
                    [1] => fbw.png
                    [2] => PNG_transp_1.jpg
                )

            [type] => Array
                (
                    [0] => image/png
                    [1] => image/png
                    [2] => image/jpeg

So i guess you have some other problems with the client. Have a look at the developer console in your browser (key F12), on the network tab , clicking on the request, switching to the "headers" panel, you should see what files are transfered, like

Request Payload

------WebKitFormBoundary6EmY005wUBqBArGt
Content-Disposition: form-data; name="Images[]"; filename="LTE_4G.png"
Content-Type: image/png


------WebKitFormBoundary6EmY005wUBqBArGt
Content-Disposition: form-data; name="Images[]"; filename="fbw.png"
Content-Type: image/png

try disabling whatever plugin you use for the upload


#3

Im trying to follow your directions


After I submit the form, I click the all tab, see the request, click it then open the headers panel. Where do I see what files are being transferred like you had?
when I select 2 images, you can see an array with the 2 images the output tab at the bottom of the console

What does that mean?


closed #4

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.