1

I can get the file object like this:

$request->files->get('file')

But i have to give my uploader php native file ($_FILES['file']).

Is there any way to get the native file from request object?

Symfony var_dump (xdebug html output):

<pre class='xdebug-var-dump' dir='ltr'>
<b>object</b>(<i>Symfony\Component\HttpFoundation\File\UploadedFile</i>)[<i>13</i>]
  <i>private</i> 'test' <font color='#888a85'>=&gt;</font> <small>boolean</small> <font color='#75507b'>false</font>
  <i>private</i> 'originalName' <font color='#888a85'>=&gt;</font> <small>string</small> <font color='#cc0000'>'slide-3.jpg'</font> <i>(length=11)</i>
  <i>private</i> 'mimeType' <font color='#888a85'>=&gt;</font> <small>string</small> <font color='#cc0000'>'image/jpeg'</font> <i>(length=10)</i>
  <i>private</i> 'size' <font color='#888a85'>=&gt;</font> <small>int</small> <font color='#4e9a06'>147845</font>
  <i>private</i> 'error' <font color='#888a85'>=&gt;</font> <small>int</small> <font color='#4e9a06'>0</font>
</pre>
1
  • 1
    Why do you have to do this? Commented Jun 24, 2014 at 15:16

1 Answer 1

1

As you can see in the HttpFoundations FileBag, https://github.com/symfony/HttpFoundation/blob/master/FileBag.php

all files are converted into UploadedFile classes, this class has all the informations a native php $_FILES['file'] has.

Symfony\Component\HttpFoundation\File\UploadedFile 

If you still want to use the $_FILES['file'], you can simply use the superglobals, the are still available. The Request just wraps the Superglobals to abstract them in an object oriented way

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.