I tried to upload an image file into a specified folder..
But it shows an Error like this
FileException in UploadedFile.php line 235:
The file "download (1).jpg" was not uploaded due to an unknown error.
My controller function is something like this
function postSave( Request $request)
{
$rules = $this->validateForm();
$validator = Validator::make($request->all(), $rules);
if ($validator->passes()) {
$data = $this->validatePost('tb_hotel');
$id = $this->model->insertRow($data , $request->input('hotel_id'));
if(!is_null(Input::file('logo')))
{
$updates = array();
$file = $request->file('logo');
$destinationPath = public_path().'/uploads/hotels/';
$filename = $file->getClientOriginalName();
$extension = $file->getClientOriginalExtension(); //if you need extension of the file
$newfilename = $id.'.'.$extension;
// print_r($newfilename);exit;
$uploadSuccess = $request->file('logo')->move($destinationPath, $newfilename);
if( $uploadSuccess ) {
$updates['logo'] = $newfilename;
}
$this->model->insertRow($updates , $id );
}
.
.
.
.
}
I don't know why!!.. I'm using the same function in another controller there it works properly..
But here it show me an error like I mention above..
Someone please help me..
Thanks
via Chebli Mohamed
1 commentaire:
same problem here.. did u solve it ? if done what was the solution
Enregistrer un commentaire