title: Laravel 5: uploading an image to send in an email
body: <p>I have never sent images that were uploaded in a form to emails before, so I'm having a bit of trouble.</p>
  
  <p>I know this line of code: <code>$request-&gt;file('image')-&gt;move('/', $fileName);</code> won't do anything because of where I'm moving it to, but that's as far as I could get reading these <a href="http://laravel.com/docs/5.1/requests#files" rel="nofollow">Laravel docs</a>. As a matter of fact, it spits out this error:</p>
  
  <p><code>Unable to write in the "/" directory</code> </p>
  
  <p>If I were to remove the above code and submit my form, everything works properly but the image fields shows up empty. That leads me to my question:</p>
  
  <p><strong>Where do I move the image to, and how do I get it from that location so that it can be used in the sent email rather than showing a blank spot as if nothing were uploaded?</strong></p>
  
  <p>Here are my files...</p>
  
  <p>index.blade.php (image part of form only):</p>
  
  <pre><code>&lt;div class="form-group"&gt;
       {!!  Form::file('image') !!}
  &lt;/div&gt;
  </code></pre>
  
  <p>emails/contact.blade.php (image part only):</p>
  
  <pre><code>&lt;p&gt;
      Image: {{ $image }}
  &lt;/p&gt;
  </code></pre>
  
  <p>Requests/ContactFormRequest.php:</p>
  
  <pre><code>&lt;?php
  
  namespace App\Http\Requests;
  
  use App\Http\Requests\Request;
  
  class ContactFormRequest extends Request
  {
      public function authorize()
      {
          return true;
      }
  
      public function rules()
      {
          return [
              'name'   =&gt; 'required',
              'height' =&gt; 'required',
              'age'    =&gt; 'required',
              'weight' =&gt; 'required',
              'gender' =&gt; 'required',
              'email'  =&gt; 'required|email',
              'image'  =&gt; 'required|mimes:jpeg,jpg,png|max:200px'
          ];
      }
  }
  </code></pre>
  
  <p>Auth/AboutController.php:</p>
  
  <pre><code>&lt;?php namespace App\Http\Controllers;
  
  use App\Http\Requests\ContactFormRequest;
  
  class AboutController extends Controller {
  
      public function create()
      {
          return view('pages.index');
      }
  
      public function store(ContactFormRequest $request)
      {
          $fileName = "Image";
          $request-&gt;file('image')-&gt;move('/', $fileName);
  
          \Mail::send('emails.contact',
              array(
                  'name'   =&gt; $request-&gt;get('name'),
                  'height' =&gt; $request-&gt;get('height'),
                  'age'    =&gt; $request-&gt;get('age'),
                  'weight' =&gt; $request-&gt;get('weight'),
                  'gender' =&gt; $request-&gt;get('gender'),
                  'email'  =&gt; $request-&gt;get('email'),
                  'image'  =&gt; $request-&gt;get('image')
              ), function($message)
          {
              $message-&gt;from('example@example.com');
              $message-&gt;to('example@example.com', 'Admin')-&gt;subject('Example Text');
          });
  
          return \Redirect::route('/')
              -&gt;with('message', 'Your application is on its way!');
      }
  
  }
  </code></pre>