0

如果没有选择图像,如何使用旧图像?

当有人更新他的个人资料但没有选择要更新的图像时,它是个人资料页面,那么旧图像应该保留在那里..

应该是这样的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;

应该怎么编码??

4

2 回答 2

1

感谢@Lion

if($_FILES["profilepic"]["error"])
{//if the file is not selected} 
else {//if the file is selected}

对我来说几乎有用.. :)

于 2013-02-02T13:26:54.700 回答
0
if(empty($_FILES['image']['name']))
{
    $image=$row['image'];
    //upload from root folder//
    $upload=$_SESSION['KCFINDER']['uploadURL'] = '/images'.$image;
    upload script
} else {
    normal upload script
}
于 2013-05-21T08:08:39.573 回答