title: Cannot use object of type Illuminate\Http\UploadedFile as array
body: <p>I try to send attachement files but i get </p>
  
  <blockquote>
    <p>Cannot use object of type Illuminate\Http\UploadedFile as array</p>
  </blockquote>
  
  <p>I use laravel 5.4 </p>
  
  <p>Someone know why i'm getting this error ? </p>
  
  <p>( I don't upload the file into a directory, i just want to send the file who was requested on my controller ) </p>
  
  <p>Hope someone could help , best regards :) </p>
  
  <p>Here my controller : </p>
  
  <pre><code>public function postSendMassive(Request $request){
  
          $files = $request-&gt;file('uploads');
  
          $emails = Structure::where('type_structure_id', 4)-&gt;pluck('adresse_email_structure');
  
          $subject = $request-&gt;subject;
          $bodyMessage = $request-&gt;texte;
  
          foreach($files as $file) {
              $files[] = [
                  'file' =&gt; $file-&gt;getRealPath(),
                  'options' =&gt; [
                      'mime' =&gt; $file-&gt;getClientMimeType(),
                      'as'    =&gt; $file-&gt;getClientOriginalName()
                  ],
              ];
          }
  
          Mail::to('test@gmaIL.com')-&gt;send(new MassiveEmail($subject , $bodyMessage , $files));
  
          return back()-&gt;with('status', "Email envoyé");
  
      }
  </code></pre>
  
  <p>here my build mail  : </p>
  
  <pre><code>public function build()
      {
  
          $subject = $this-&gt;subject;
          $bodyMessage = $this-&gt;bodyMessage;
          $files = $this-&gt;files;
  
          $email =  $this-&gt;markdown('email.MassiveMail',compact('bodyMessage'))
              -&gt;subject($subject.'-'.'FFRXIII Licences &amp; Compétitions');
  
  
          foreach($this-&gt;files as $file) {
              $email-&gt;attach($file['file'],$file['options']);
          }
  
          return $email;
      }
  </code></pre>