我有一个带有表单的页面,用户可以在其中上传图像以替换他现有的头像。
但是,如果用户提交表单而不上传图片,我不会更新他的头像,用户可以保留他的旧头像。
这是一个更新问题,所以我需要这样的伪代码:
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
不过,我只需要第一行。
有人可以帮忙吗?我在文档中找不到太多关于此的内容。