0

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

3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by nivibala
0

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'";
0

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

Edited by altarek: n/a

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.