I created a form with file
and uploads the file and stores the data in the database very well. The problem is, I need to store the modified file name in the database but the Laravel stores the temporary name in the database. This is the code
public function store(Request $request)
{
$image = $request->file('file');
$imageName = time().rand(1,100).$image->getClientOriginalName();
$image->move(public_path('uploads'),$imageName);
$request['file'] = $imageName;
//$request->file = $imageName;
$im = new Image($request->all());
$this->user->images()->save($im);
}
I tried to modify the file
manually but it didn't work. This the dd
of $request
But still the temporary file name is inserted in to database.
This is the table and file
column must have the name of the file
As you see the file name I provided is not in the file
column, the temporary is in there