At no point in this snippet do you actually save the $img instance.
Also, you have a typo in the line $image = Imag::make(...) - should that be Image::make? If it's returning null, you're writing null to the filesystem. Can you verify that the file is actually uploaded?
public function store()
{
$input = Input::all();
$this->uploadImageForm->validate($input);
//$user = Auth::user();
$img = new Image;
$img->title = Input::get('title');
$img->description = Input::get('description');
$img->status = Input::get('status');
$img->user_id = Auth::user()->id;
//$user->images()->attach($img->id);
if (Input::hasFile('file'))
{
$file = Input::file('file');
$name = time() . '-' . $file->getClientOriginalName();
$file = $file->move(public_path(). '/images/'.Auth::user()->username .'/', $name);
$image = Imag::make($file->getRealPath())->resize('1024','700')->save($file);
$namee = Flysystem::put($file, $image);
Flysystem::connection('local')->delete($file);
$img->file = $namee;
}
//
// Add the connection between the image and the user
if ($img->save())
{
return Redirect::back()->with(['global' => 'Your image file has been uploaded successfully.', 'type' => 'success']);
}else
{
return Redirect::back()->with(['global'=> 'Your upload could not be succeeded.' , 'type' => 'danger']);
}
}
I can see in public folder uploaded image and my bucket it make folder "C:\lamp\www\flash\public" and inside it make folder "images" and inside it image name "Vipin\1425369470-beautiful_girls_10-wallpaper-1366x768.jpg"