I have a perfectly working upload form at the moment, but I am having a hard time figureing out how to add the ability to generate other fields to submit along with the upload. Has anyone ever made a file upload form that submits other information such as the authors name (i'm uploading documents). Would it be hard to have a table generate from a form like that after a file was uploaded? I'm thinking I could store both the author and file in an mysql database, but would I have to separate that from the actual upload script?
Heres what I have so far:
PHP Code:
<?php
$numfile = 20;
$servdir = "my file dir";
if ($_POST)
{
for ($i=0;$i<$numfile;$i++)
{
if (trim($_FILES['myfiles']['name'][$i])!="")
{
$newfile = $servdir.$_FILES['myfiles']['name'][$i];
move_uploaded_file($_FILES['myfiles']['tmp_name'][$i], $newfile);
$x++;
}
}
}
if (isset($x)&&$x>0) print "All went well.<br>";
print "<form method='post' enctype='multipart/form-data'>";
for($i=0;$i<$numfile;$i++)
{
print "<input type='file' name='myfiles[]' size='30'><br>";
}
print "<input type='submit' name='action' value='Upload'>";
print "</form>";
?>