Problem is in getting image file, EXAMPLE: create user's profile with name and photo. But after that I want to change name and my EDIT form has two field NAME and PHOTO, but I want to change ONLY NAME, but input file always empty and default value null. So if will not to choose a picture and click submit, then in my db the path to image will change to null. So how I can get image? I read about hash but did not understand how is it to use
Asked
Active
Viewed 121 times
0
-
2`if(request('image')) //rest of your code` If no image is provided - don't set it. – KiprasT Dec 09 '19 at 13:04
-
check if has a file in request if ($request->hasFile('photo')) { // update photo } – waleedazam Dec 09 '19 at 16:04
1 Answers
2
You can use this code:
$image = '';
if ($image != null) {
"Use query upload image" ;
} else {
"Use query update" ;
}

Clément Baconnier
- 5,718
- 5
- 29
- 55

reza yavari
- 126
- 6