I have a page with a form where user can upload an image to replace his existing avatar.
However, if the user submits forms without uploading an image, I will not update his avatar and user can keep his old avatar.
This is an UPDATE issue so I need something like this in pseudo code:
if (Input::has_uploaded_file() === true)
//User uploaded something, update avatar column/remove old avatar etc.
else
//User didn't upload anything so don't update avatar column
I just need the first line, though.
Can anybody help? I couldn't find much about this in documentation.
If Input::has_file('name')
does not work for you then you can use the equivalent of what it is doing, like this...
if (Input::file('name.tmp_name', '') != '')
Taken from laravel/input.php