<html>
<form enctype="multipart/form-data" action="upload.php" method="post">
<p> Address:
<input type=text name=address>
<br>
Email:
<input type=text name=email>
<br>
name
<input type=text name=mainname>
</p>
<p>File
<input name="userfile" type="file" />
<input name="submit" type="submit" value="Send File" />
</p>
</form>
</html>
php:
Code: Select all
<?php
srand(time());
$random1 = (rand()%99999);
$random2 = (rand()%99999);
$random3 = $random1 . $random2;
$file = $_FILES['userfile']['name'];
$content = $mainname;
$content.= "Address: " .$address;
$content.= "Email: " .$emailaddress;
$content.= "ID thingy: " .$file;
set_time_limit(3000);
$uploaddir = 'C:\\inetpub\\clients\\awt969\'';
$uploadfile = $uploaddir . $random3 . $_FILES['userfile']['name'];
print "<pre>";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
print "Done";
mail("me@me.com", "Title", $content);
}
else {
Print "There was an whilst uploading" . $file . "<br>Please email the file to me@me.com";
}
?>