Forum Moderators: coopster
Anyone have a clue?
Thanks for your help in advance,
a php newb
You could probably just have the form save the image to a directory on the site then you can put just the path in the email.
this is a really simple one
<form action="<?= $_SERVER['PHP_SELF']?>" enctype="multipart/form-data" method="post">
<table>
<tr>
<td colspan=2>Click on the Browse button below
<BR>then locate the file on your computer and press "Open".
<BR>Then press the submit button to upload the file.
<P> </td>
</tr>
<tr>
<td>File : </td>
<td><input name="file" type="file" /></td>
</tr>
<tr>
<td></td>
<td><input name="files" type="submit" value="Submit" /></td>
</tr>
</table>
</form>
<?php
//this is the name of the directory the script will upload to
//this directory should be located in the same directory as the uploading script.
$dir = "dirname/";
if ($_POST["files"]) {
if (!file_exists($dir . $_FILES["file"]["name"])) {
copy($_FILES["file"]["tmp_name"], $dir . $_FILES["file"]["name"]);
$file = $_FILES["file"]["name"];
print("Your file has been uploaded.<br /><br />\n");
}
else {
print("Filename already exists.<br /><br />\n");
}
}
?>
then just put the filename $_FILES["file"]["name"] into your message then you can download the image at your leisure or link to it where it is.