I'm trying to set up an upload form that allows my customer to append the order number to the file being uploaded.
I've got a two page process that is close. It assigns a random four digit number to the file. I can add a field to the form to ask for the order number but can't figure out how to carry that field (a six digit number) to the second page, the upload page. The code I have is:
Page One:
<input name="ufile" type="file" id="ufile" size="50" /></td>
</tr>
<tr>
<td>Order Number
<input name="orderid" size="6" /></td>
</tr>
<tr>
<td align="center"><input type="submit" name="Submit" value="Upload" /></td>
</tr>
</table>
</td>
</form>
Page Two:
<?php
// Your file name you are uploading
$file_name = $HTTP_POST_FILES['ufile']['name'];
//Order number
$order_id = ??????;
//combine order number to you file name to create new file name
//use dot (.) to combile these two variables
$new_file_name=$order_id.$file_name;
//set where you want to store files
//in this example we keep file in folder upload
//$new_file_name = new upload file name
//for example upload file name cartoon.gif . $path will be upload/cartoon.gif
$path= "upload/".$new_file_name;
if($ufile !=none)
{
if(copy($HTTP_POST_FILES['ufile']['tmp_name'], $path))
{
echo "Successful<BR/>";
//$new_file_name = new file name
//$HTTP_POST_FILES['ufile']['size'] = file size
//$HTTP_POST_FILES['ufile']['type'] = type of file
echo "File Name :".$new_file_name."<BR/>";
echo "File Size :".$HTTP_POST_FILES['ufile']['size']."<BR/>";
echo "File Type :".$HTTP_POST_FILES['ufile']['type']."<BR/>";
}
else
{
echo "Error";
}
}
?>
Any help is appreciated.
Thanks,
Jim