/*
As for the email is simpler, you can use mail () function mail ("Recipient address", "subject", "Body", "From: Sender Reply-to: Sender's address");
However, mail () requires the support of the server, in Windows also need to configure the SMTP server, generally outside the Linux space is OK.
It seems that uploading files and sending emails is much simpler than ASP, as long as you call a function. ASP also needs to use different components of the server such as FSO, JMail and so on.
Here to see the file upload instance
File form must be added enctype= "Multipart/form-data" and <input type= "file" name= "file" >
The code is as follows |
Copy Code |
$f =& $HTTP _post_files[' file ']; $dest _dir= ' uploads '/set upload directory $dest = $dest _dir. '/'. Date ("Ymd"). " _ ". $f [' name '];//me here Set file name to date plus filename to avoid duplication $r =move_uploaded_file ($f [' Tmp_name '], $dest); chmod ($dest, 0755);//Set the properties of the uploaded file |
The uploaded file name is date ("Ymd"). _ ". $f [' name '], which can be used later in the tutorial on the database, PHP actually moves your uploaded files from the temp directory to the specified directory.
Move_uploaded_file ($f [' Tmp_name '], $dest); That's the key.