php - Using Input::all() when uploading files in laravel 4.2 -


according this, if following

<?php  // app/routes.php  route::get('/', function() {     return view::make('form'); });  route::post('handle-form', function() {     var_dump(input::all()); }); 

we'll following:

array(0) { } 

according dayle rees, because files stored in $_files array , not in $_get or $_post. when change second function to:

route::post('handle-form', function() {     var_dump(input::file('book')); }); 

we get:

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(14) "codebright.pdf"<   ["mimetype":"symfony\component\httpfoundation\file\uploadedfile":private]=><   string(15) "application/pdf"<   ["size":"symfony\component\httpfoundation\file\uploadedfile":private]=><   int(2370413)<   ["error":"symfony\component\httpfoundation\file\uploadedfile":private]=><   int(0)<   ["pathname":"splfileinfo":private]=><   string(36) "/applications/mamp/tmp/php/phppob0vx"<   ["filename":"splfileinfo":private]=><   string(9) "phppob0vx"< }< 

however, in project, when use input::all(), still correct output identical above. file used different, hope point. why projects giving different outputs book?

if see /vendor/laravel/framework/src/illuminate/http/request.php,

/**  * of input , files request.  *  * @return array  */ public function all() {     return array_replace_recursive($this->input(), $this->files->all()); } 

which contains both files , other inputs. since codebright started laravel 3, ( http://goo.gl/nwltlh ), suppose (but not sure), section of code updated later on laravel 4.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -