Posts: 27
Location: Holland Amsterdam
|
Hi there i would like to add an upload feature to my form i have a basic form
1. name
2. email
3. comments
but i would like to add the upload feature in the same form, i think this is the code but i do not know the right way to do this
<html>
<head>
<title>Upload</title>
<body>
<?php
$uploaddir = '/home/username/public_html/uploads/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}
?>
</body>
my question is, should i work this piece of code as apart .PHP file or try to insert it the .PHP file of my form actual form.
Thanks in advance
Last edited by latintrans; 07-05-2006 at 11:58 AM..
|