Hello

at update form i have upload file and i want if it have value does not change

I used this code to upload at insert form

$lfile =   basename( $_FILES['file']['name']) ;
$target_path = "files/";

$target_path = $target_path . basename( $_FILES['file']['name']); 

if(move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) {
echo"file uploaded"
} else{
 echo "There was an error";
}

any help

You question is not clear,

If you do not want name to change in update, then you may ignore writing column name in update query.

insert="insert into table (col1, col2, col3,filename) values ('1','2','3','myfile')";

update="update  table set col2='2', col3='3' where col1='1'";

I want to if there is an existing file appears in the update form , and if I want to change I can change it

While you update the form, just check the condition if "file" field is not empty (!empty(basename($_FILES)) or (strlen($_FILES) >0 ) then you update the file in db otherwise not update.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.