how can I get multiple input fields to work with this form?
Posted: Wed Jun 25, 2008 10:16 pm
I'm playing around with an image uploader so I can send some images to a server. I have it working properly with one field, but I'm not sure how to add multiple fields and then get all of the images to go at one time.
Here's the code I'm using right now:
<?php
if ($_REQUEST[completed] == 1) {
$newname = uniqid("file").".jpg";
move_uploaded_file($_FILES['mailfile']['tmp_name'],
"uploads/$newname");
} ?>
<html>
<head><title>Uploader</title></head>
<body><h1>Uploader</h1>
<?php if ($_REQUEST[completed] != 1) { ?>
<b>Please upload images below</b><br>
<form enctype=multipart/form-data method=post>
<input type=hidden name=MAX_FILE_SIZE value=1500000>
<input type=hidden name=completed value=1>
Choose files to send: <br />
<input type=file name=mailfile><br />
<input type=submit value="upload"></form>
<?php } else { ?>
<b>Upload Successful!</b>
<?php } ?>
</body></html>
Can anyone tell me how to have multiple fields with only one submit button so they all get uploaded at once?
Here's the code I'm using right now:
<?php
if ($_REQUEST[completed] == 1) {
$newname = uniqid("file").".jpg";
move_uploaded_file($_FILES['mailfile']['tmp_name'],
"uploads/$newname");
} ?>
<html>
<head><title>Uploader</title></head>
<body><h1>Uploader</h1>
<?php if ($_REQUEST[completed] != 1) { ?>
<b>Please upload images below</b><br>
<form enctype=multipart/form-data method=post>
<input type=hidden name=MAX_FILE_SIZE value=1500000>
<input type=hidden name=completed value=1>
Choose files to send: <br />
<input type=file name=mailfile><br />
<input type=submit value="upload"></form>
<?php } else { ?>
<b>Upload Successful!</b>
<?php } ?>
</body></html>
Can anyone tell me how to have multiple fields with only one submit button so they all get uploaded at once?