Study goal: The academic society uploads the document with PHP and sends the mail
The upload document form must add on enctype= ” multipart/form-data ”
With <input type= ” file ” name= ” file ” >
Below looks at the code:
$f=&$HTTP_POST_FILES [’file’];
$dest_dir=’uploads’;//hypothesis upload table of contents
$dest=$dest_dir. ‘/’ .date (“ymd”).”_ “. $f [’name’]; // my here establishes the document named date to add on the filename avoid repetition
$r=move_uploaded_file ($f [’tmp_name’], $dest);
chmod ($dest, 0755); // hypothesis upload document attribute
Upload document named date (“ymd”).”_ “. $f [’name’], may will insert in later to database time use, PHP will in fact be the document which will upload you moves from the temporary table of contents to assigns the table of contents. move_uploaded_file ($f [’tmp_name’], $dest); This is a key
As for sends the mail to be simpler, may use the mail() function
mail (“addressee address”, “subject”, “main text”, “From: Addresser \ r \ nReply-to: Addresser’s address”);
However mail() needs server’s support, also needs to dispose the SMTP server under WINDOWS, generally speaking the outside LINUX space is good.
Probably the upload document and sends the mail to be simpler than many ASP, so long as the transfer function might. ASP also needs to use server’s different module for instance FSO, JMAIL anything.
RSS feed for comments on this post · TrackBack URI
Leave a reply