Page 1 of 1

[SOLVED] - Max No Of File Uploads

Posted: Mon Aug 09, 2004 11:13 pm
by anjanesh
I have this is code for mutiple file uploads :

Code: Select all

<?php if (isset($_POST['hiddenFile'])) echo count($_FILES['HousePhotos']); ?> 
<FORM ACTION="" METHOD=POST NAME="frm" ENCTYPE="multipart/form-data"> 
<INPUT TYPE=hidden NAME="hiddenFile"> 
<TABLE> 
<?php 
for ($i=0;$i<10;$i++) 
{ 
    ?> 
    <TR><TD>Photo <? echo ($i+1); ?> : </TD><TD><INPUT TYPE="file" NAME="HousePhotos[]"></TD></TR> 
    <? 
} 
?> 
<TR><TD><INPUT TYPE=submit NAME=subMit VALUE=Send></TD></TR> 
</TABLE> 
</FORM>
echo count($_FILES['HousePhotos']); is always displaying 5. I even tried using 10 html lines of <INPUT TYPE="file"> and still it shows 5.

Anyidea how to have this fixed ?
Thanks

Posted: Tue Aug 10, 2004 12:18 am
by phice
Have you tried doing something like...

Code: Select all

print "<pre>\n";
print_r($_FILES);
print "</pre>\n";
and see what that gets you?

Posted: Tue Aug 10, 2004 12:55 am
by anjanesh
Its showing this (I just edited the indentation for posting here and did not enter any fields in the file box) :

Code: Select all

Array (
&#1111;HousePhotos] =>
Array (
  &#1111;name]=>Array (&#1111;0]=> &#1111;1]=> &#1111;2]=> &#1111;3]=> &#1111;4]=> &#1111;5]=> &#1111;6]=> &#1111;7]=> &#1111;8]=> &#1111;9]=> )
  &#1111;type]=>Array (&#1111;0]=> &#1111;1]=> &#1111;2]=> &#1111;3]=> &#1111;4]=> &#1111;5]=> &#1111;6]=> &#1111;7]=> &#1111;8]=> &#1111;9]=> )
  &#1111;tmp_name]=>Array ( &#1111;0]=> &#1111;1]=> &#1111;2]=> &#1111;3]=> &#1111;4]=> &#1111;5]=> &#1111;6]=> &#1111;7]=> &#1111;8]=> &#1111;9]=> )
  &#1111;error]=>Array (&#1111;0]=> 4 &#1111;1]=> 4 &#1111;2]=> 4 &#1111;3]=> 4 &#1111;4]=> 4 &#1111;5]=> 4 &#1111;6]=> 4 &#1111;7]=> 4 &#1111;8]=> 4 &#1111;9]=> 4)
  &#1111;size]=>Array (&#1111;0]=> 0 &#1111;1]=> 0 &#1111;2]=> 0 &#1111;3]=> 0 &#1111;4]=> 0 &#1111;5]=> 0 &#1111;6]=> 0 &#1111;7]=> 0 &#1111;8]=> 0 &#1111;9]=> 0)
)
)
The error values are showing up as 4 which is normal because no file was uploaded.

Posted: Tue Aug 10, 2004 12:57 am
by feyd
that's functioning correctly..

Posted: Tue Aug 10, 2004 1:00 am
by anjanesh
Oh. Its ok. Got it. count ($_FILES['HousePhotos']) will always return 5 because there are only 5 arrays in them. I had to do $_FILES['HousePhotos']['name'] to return the total number of files input boxes.