Hiii, I used upload file function but , I have error Call to a member function move() on a non-object. My function $img = Input::file('image');
// Form Validation
$rules = array('image' => 'required');
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
echo "a";die;
} else {
// Images destination
$img_dir = "uploads/images/" . date("mY");
$img_thumb_dir = $img_dir . "/thumbs";
// Create folders if they don't exist
if (!file_exists($img_dir)) {
mkdir($img_dir, 0777, true);
mkdir($img_thumb_dir, 0777, true);
}
// Upload the image in the correct destination
$upload_success = $img->move($img_dir, $img->getClientOriginalName());
if ($upload_success) {
echo "b";die;
}
}
People to help me , Please. Thank you verymuch
check if your image is not to big (file size) to upload (php.ini -> upload_max_filesize, post_max_size)
In addition to what @zenry suggested, you can also check if a file is available / uploaded:
if (Input::hasFile('image'))
{
//
}
zenry said:
check if your image is not to big (file size) to upload (php.ini -> upload_max_filesize, post_max_size)
Thanks you, i try upload file 100kb but i have this error
usm4n said:
In addition to what @zenry suggested, you can also check if a file is available / uploaded:
if (Input::hasFile('image')) { // }
Thanks, but images variable, i do var_dump($img) and it show many value , name,size ,.... i user $img->getClientOriginalName(), it still error Call to a member function getClientOriginalName() on a non-object.Summary, i don't use these function
try on your View set ** 'files' => true** e.g.
{{ Form::open(array('url' => 'app/save', 'files' => true)) }}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community