Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy files don't get uploaded with this HTML/PHP?
    primarykey
    data
    text
    <pre><code> &lt;?php require_once 'swift-mailer/lib/swift_required.php'; if (isset($_POST['submit'])) { //File upload // Where the file is going to be placed $target_path = "uploads/"; // Add the original filename to our target path. //Result is "uploads/filename.extension" $target_path = $target_path . basename($_FILES['uploadedfile']['name']); if (is_uploaded_file($_FILES['uploadedfile']['tmp_name'])) { if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename($_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } } //End of file upload //Create the Transport $transport = Swift_MailTransport::newInstance(); //Create the Mailer using your created Transport $mailer = Swift_Mailer::newInstance($transport); //Create the message $message = Swift_Message::newInstance(); //Give the message a subject $message-&gt;setSubject('New data submitted'); $ip=$_SERVER['REMOTE_ADDR']; $date=date("l, F j, Y, g:i a"); //Give it a body $message-&gt;setBody("Here is the information submitted to your site from $ip on $date.\n\n --------------------------------\n\n name: User \n\n email address: user@hotmail.com \n\n subject: Test \n\n comment: Test comment"); //Add alternative parts with addPart() //$message-&gt;addPart('My amazing body in plain text', 'text/plain'); //Create the attachment // * Note that you can technically leave the content-type parameter out $attachment = Swift_Attachment::fromPath($target_path); //Attach it to the message $message-&gt;attach($attachment); //Using setTo() to set all recipients in one go $message-&gt;setTo(array('me@gmail.com' =&gt; 'VB')); //Set a From: address including a name $message-&gt;setFrom(array('me@gmail.com' =&gt; 'Contact Us')); //Send the message $numSent = $mailer-&gt;send($message); //printf("Sent %d messages\n", $numSent); if(isset($_FILES['uploadedfile'])){ $pathfile = "/home/me/mysite/uploads/" . $_FILES['uploadedfile']['name']; @unlink($pathfile); } $to = "$email"; $subject = "Thank You!"; $body = "Thank you for e-mailing us. We will reply as soon as possible."; // fix for thank you email address $headers = "From: vlevsha@gmail.com\r\n" . "Reply-To: vlevsha@gmail.com\r\n" . "X-Mailer: PHP/" . phpversion(); mail($to, $subject, $body, $headers); } ?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"&gt; &lt;head&gt; &lt;title&gt;Plain Form&lt;/title&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form" action="plain_upload.php" method="post"&gt; &lt;p&gt; &lt;input type="file" name="uploadedfile" /&gt; &lt;/p&gt; &lt;p&gt; &lt;input type="submit" name="submit" /&gt; &lt;/p&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Thank you all in advance!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload