如果没有选择图像,如何使用旧图像?
当有人更新他的个人资料但不选择要更新的图像时,这是一个个人资料页面,那么旧图像应该保留在那里。
应该像这个 if-else 语句还是会有其他方法?
//check if file is selected.
if (empty($_FILES['profilepic']))
{
//if file selected this code should run
$fileselected="file selected";
}
else
{
//this executes if file not selected
$fileselected="No File Has Been Selected";
}
echo $fileselected;
应该如何编码??
感谢@Lion
if($_FILES["profilepic"]["error"])
{//if the file is not selected}
else {//if the file is selected}
几乎对我有用.. :)
if(empty($_FILES['image']['name']))
{
$image=$row['image'];
//upload from root folder//
$upload=$_SESSION['KCFINDER']['uploadURL'] = '/images'.$image;
upload script
} else {
normal upload script
}