|
-
Jul 24th, 2003, 02:18 PM
#1
Thread Starter
Stuck in the 80s
[Resolved] File Uploads and Arrays?
I have a form somewhat like this:
Code:
<form action="index.php" method="post">
1. <input type="file" name="f[]"><br>
2. <input type="file" name="f[]"><br>
3. <input type="file" name="f[]"><br>
<input type="submit" value=" Send ">
</form>
Now, how can I tell how many, if any, of these include files?
I tried something like:
Code:
echo count($_FILES['f']);
//and:
echo count($_POST['f']);
But neither work.
Last edited by The Hobo; Jul 24th, 2003 at 03:15 PM.
-
Jul 24th, 2003, 03:12 PM
#2
Thread Starter
Stuck in the 80s
I guess I'm going to assume that I can't use arrays with file types. The following code works for the text type, but not the file:
Code:
<?php
if (isset($_POST['submit'])) {
echo $_FILES['my_file'][0]['type'] . '<br>';
echo $_POST['my_text'][0];
} else {
echo '<form action="testupload.php" method="post" enctype="multipart/form-data">
<input type="file" name="my_file[]">
<br>
<input type="text" name="my_text[]">
<br>
<input type="submit" name="submit" value=" Send ">
</form>';
}
?>
-
Jul 24th, 2003, 03:14 PM
#3
Thread Starter
Stuck in the 80s
Ah ha!
Code:
$_FILES['my_file'][0]['type']; //should be:
$_FILES['my_file']['type'][0];
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|