Note that there are some explanatory texts on larger screens.

plurals
  1. POMultiple upload looping
    primarykey
    data
    text
    <p><em><strong>For some reason i have to put all input field into array.Because the input are dynamically added up to user.</em></strong></p> <p>When user click on add button ,will generated the following for upload image</p> <pre><code>&lt;input type="file" name="product['+n+'][gthumbnail][]" /&gt; </code></pre> <p><em><strong>But i have no idea how to loop the available array(filled)</em></strong>.I don't even get to count the array size.And these are my working code.Hope every expert out there can point out the mistake I did</p> <pre><code>//loop for image file upload foreach($product as $productcount){ .... .... .... //this is what i have now ,and it is not working,error saying the gthumbnail is undefined for($i=0;$i&lt;sizeof($_FILES['gthumbnail']);$i++){ $m=uploadFile($_FILES['gthumbnail'][$i]); } }//End of product loop </code></pre> <p>print_r($FILES)</p> <pre><code>Array ( [product] =&gt; Array ( [name] =&gt; Array ( [1] =&gt; Array ( [thumbnail] =&gt; [gthumbnail] =&gt; Array ( [0] =&gt; [1] =&gt; [2] =&gt; ) [gphoto] =&gt; Array ( [0] =&gt; [1] =&gt; [2] =&gt; ) ) ) [type] =&gt; Array ( [1] =&gt; Array ( [thumbnail] =&gt; [gthumbnail] =&gt; Array ( [0] =&gt; [1] =&gt; [2] =&gt; ) [gphoto] =&gt; Array ( [0] =&gt; [1] =&gt; [2] =&gt; ) ) ) [tmp_name] =&gt; Array ( [1] =&gt; Array ( [thumbnail] =&gt; [gthumbnail] =&gt; Array ( [0] =&gt; [1] =&gt; [2] =&gt; ) [gphoto] =&gt; Array ( [0] =&gt; [1] =&gt; [2] =&gt; ) ) ) [error] =&gt; Array ( [1] =&gt; Array ( [thumbnail] =&gt; 4 [gthumbnail] =&gt; Array ( [0] =&gt; 4 [1] =&gt; 4 [2] =&gt; 4 ) [gphoto] =&gt; Array ( [0] =&gt; 4 [1] =&gt; 4 [2] =&gt; 4 ) ) ) [size] =&gt; Array ( [1] =&gt; Array ( [thumbnail] =&gt; 0 [gthumbnail] =&gt; Array ( [0] =&gt; 0 [1] =&gt; 0 [2] =&gt; 0 ) [gphoto] =&gt; Array ( [0] =&gt; 0 [1] =&gt; 0 [2] =&gt; 0 ) ) ) ) ) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload