I have an object which is a file in origin and i would like to send this object in a post form.
When i try this :
{{ Form::open(array('url' => 'mgmtUser/upload_img_crop/', 'method' => 'POST', 'files' => true)); }}
<input hidden type="file" name="file" value="<?php $file; ?>">
<?= Form::hidden('x', '', array('id' => 'x')) ?>
<?= Form::hidden('y', '', array('id' => 'y')) ?>
<?= Form::hidden('w', '', array('id' => 'w')) ?>
<?= Form::hidden('h', '', array('id' => 'h')) ?>
<?= Form::submit('Crop it!') ?>
<?= Form::close() ?>
The post result is only : ["file"]=> NULL
Why and how I can get all the object, should I encode, serialize...? I am on laravel 4. $file is :
object(Symfony\Component\HttpFoundation\File\UploadedFile)#9 (7) { ["test":"Symfony\Component\HttpFoundation\File\UploadedFile":private]=> bool(false) ["originalName":"Symfony\Component\HttpFoundation\File\UploadedFile":private]=> string(11) "3bb13ad.jpg" ["mimeType":"Symfony\Component\HttpFoundation\File\UploadedFile":private]=> string(10) "image/jpeg" ["size":"Symfony\Component\HttpFoundation\File\UploadedFile":private]=> int(8017) ["error":"Symfony\Component\HttpFoundation\File\UploadedFile":private]=> int(0) ["pathName":"SplFileInfo":private]=> string(14) "/tmp/phpVGS9Cu" ["fileName":"SplFileInfo":private]=> string(9) "phpVGS9Cu" }
$file
that you are passing to the hidden input? – James