Symfony2 Get File Object as PHP Native $_FILE -
i can file object this:
$request->files->get('file')
but have give uploader php native file ($_files['file']
).
is there way native file 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'>=></font> <small>boolean</small> <font color='#75507b'>false</font> <i>private</i> 'originalname' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'slide-3.jpg'</font> <i>(length=11)</i> <i>private</i> 'mimetype' <font color='#888a85'>=></font> <small>string</small> <font color='#cc0000'>'image/jpeg'</font> <i>(length=10)</i> <i>private</i> 'size' <font color='#888a85'>=></font> <small>int</small> <font color='#4e9a06'>147845</font> <i>private</i> 'error' <font color='#888a85'>=></font> <small>int</small> <font color='#4e9a06'>0</font> </pre>
as can see in httpfoundations filebag, https://github.com/symfony/httpfoundation/blob/master/filebag.php
all files converted uploadedfile classes, class has informations native php $_files['file'] has.
symfony\component\httpfoundation\file\uploadedfile
if still want utilize $_files['file'], can utilize superglobals, still available. request wraps superglobals abstract them in object oriented way
php symfony2 file-upload
No comments:
Post a Comment