In article <40*********************@news.xs4all.nl>,
"Roy G. Vervoort" <ro**********@rojaal.nl> wrote:
With them help of newsgroups I created a form that makes it possible to sent
an email with an attachement thats on the internet.. How can i attache a
file thats on the users harddrive?
this works great (i upladed the file bijlage.doc)
"FileName"=>"http://www.royvervoort.nl/testatt/bijlage.doc",
i would like to attche the file from my c drive
"FileName"=>"c:\bijlage.doc",
PHP can't access the HD of the computer viewing the HTML page. You have
to create a form that has field upload field. As such:
<form action="/insert.php" method="post" enctype="multipart/form-data">
<input type='text' name='subject' />
<input type='file' name='thefile' />
</form>
And in insert.php:
if (file_exists($_FILES["thefile"][tmp_name]){
# Ok, we have a file uploaded.
$filepath = "/temp/path/" . $_FILES["thefile"][name]
move_uploaded_file($_FILES["thefile"][tmp_name], $filepath);
}
Now, when creating the mail(), you can access the $filepath variable
for its location on the harddrive, and you may want to delete that file
after sending the mail.
--
Sandman[.net]