title: swiftmailer and email form with attachment - beginner
body: <p>As always here is the place where I have learned a lot. And I have now a new things to learn:</p>
  
  <p>I have a html form:</p>
  
  <pre><code>&lt;tr&gt;&lt;td width="16%"&gt;File attachment&lt;/td&gt;&lt;td width="2%"&gt;:&lt;/td&gt;&lt;td&gt;&lt;input type="file" name="fileatt" /&gt;&lt;/td&gt;&lt;/tr&gt;
  </code></pre>
  
  <p>and a mail.php:</p>
  
  <pre><code>$attachfile=$_POST["fileatt"];
  </code></pre>
  
  <p>and a correct swiftmailer code to send emails out;</p>
  
  <p>I have googled and I found many examples how to send attachment with a file stored on the website but I would like to do it on the fly. So when you submit the button it would send it to peoples out rather than uploading the file.</p>
  
  <pre><code>// Create the Transport
  $transport = Swift_SmtpTransport::newInstance('mail.server.co.uk', 25)
  -&gt;setUsername('user')
  -&gt;setPassword('pass')
  ;
  
  // Create the Mailer using your created Transport
  $mailer = Swift_Mailer::newInstance($transport);
  
  // Create a message
  $message = Swift_Message::newInstance($subject)
    -&gt;setFrom(array('emai@emai.com' =&gt; 'name'))
  
     -&gt;setBody($html, 'text/html')
    ;
  // Add alternative parts with addPart()
  $message-&gt;addPart(strip_tags($html), 'text/plain');
  
  // Send the message
  $result = $mailer-&gt;send($message);
  </code></pre>
  
  <p>could anyone help me how to do the on the fly file uploading, please? Thanks in advance!!!</p>