[SOLVED] - Max No Of File Uploads

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

[SOLVED] - Max No Of File Uploads

Post 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
Last edited by anjanesh on Tue Aug 10, 2004 1:00 am, edited 1 time in total.
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Post 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?
Image Image
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post 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.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

that's functioning correctly..
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post 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.
Post Reply