Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/396.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Laravel 4输入文件在post后返回空。。为什么?_Javascript_Php_Jquery_Html_Laravel - Fatal编程技术网

Javascript Laravel 4输入文件在post后返回空。。为什么?

Javascript Laravel 4输入文件在post后返回空。。为什么?,javascript,php,jquery,html,laravel,Javascript,Php,Jquery,Html,Laravel,Laravel 4输入文件在post后返回空。。为什么? 刀片文件中的html代码 <div id='images'> <input type='hidden' id='imagescounter' name='imagescounter' value='1'> <input type='file' id='image_1' name='image_1' class='col-md-12' onchange='$("#task").val("uploadtotemp

Laravel 4输入文件在post后返回空。。为什么?

刀片文件中的html代码

<div id='images'>
<input type='hidden' id='imagescounter' name='imagescounter' value='1'>
<input type='file' id='image_1' name='image_1' class='col-md-12' onchange='$("#task").val("uploadtotemp");$("#temp_count").val(1);$("#addbirdfrm").submit();' >
</div>
<?php
    $image = asset("images/controls/previewbird.png");
?>
<a href='#' onclick='addimageinput($("#imagescounter").val(),"{{ $image }}");return false;' id='addimageinput'><span class="glyphicon glyphicon-plus-sign top-1" aria-hidden="true"></span> </a>
<div id='previews'>
<input type='hidden' name='temp_count' id='temp_count' value=''>
<img id='preview_1' name='preview_1' src='{{ asset("images/controls/previewbird.png") }}'>
</div>
和在控制器文件中

public function postGetTemp(){
        return Input::file('image_1')->getClientOriginalName();
}
为什么此代码返回空数据

当控制器代码更改为时,数据返回0

public function postGetTemp(){
        return 0;
}
那么为什么Input::file('image_1')没有返回数据呢?
谢谢

Input::file()
是一个
Symfony\Component\HttpFoundation\file\UploadedFile
对象,而不是一个可打印的元素。使用
var_dump()
dd()
读取它。

返回数组(14){[“id”=>string(2)“12”[“gander”]=>string(4)“male”[“category_0”]=>string(1)“0”[“category_counter”]=>string(1)“0”[“full_category”=>string(0)””[“date”=>string(10)“2014-11-28”[“age”=>string(0)”[“ringdetails”=>string(0)”[“nots”]=>string(0)”“[“ImageSconter”]=>string(1)”1”[“temp_count”]=>string(1)”1”[“task”]=>string(12)”uploadtotemp”[“where”]=>string(4)“bird”[“\u token”]=>string(40)”LCX75UALABQETSKMI3HBDVENP3JLW8USNKIJR”}未返回的图像:(您需要对此文件做什么?您必须使用
Input::file('image\u 1')->移动($destinationPath,$fileName);
上传它。Input::file('image_1')->getClientOriginalName();返回null为什么?注意了解可以在
Input::file()
上使用的方法(有一些)嘿@khaledbelal是否可能是您忘记在
表单上设置
enctype=“multipart/form data”
public function postGetTemp(){
        return 0;
}