Jump to content

Recommended Posts

files that upload during insert/submit form was gone , only files upload during the update remain , is the way query for update multiple files is wrong ?


$targetDir1= "folder/pda-semakan/ic/";
if(isset($_FILES['ic'])){
     $fileName1 = $_FILES['ic']['name'];
 $targetFilePath1 = $targetDir1 . $fileName1;
 //$main_tmp2 = $_FILES['ic']['tmp_name'];
$move2 =move_uploaded_file($_FILES["ic"]["tmp_name"], $targetFilePath1);
}

$targetDir2= "folder/pda-semakan/sijil_lahir/";
if(isset($_FILES['sijilkelahiran'])){
     $fileName2 = $_FILES['sijilkelahiran']['name'];
 $targetFilePath2 = $targetDir2 . $fileName2;
$move3 =move_uploaded_file($_FILES["sijilkelahiran"]["tmp_name"], $targetFilePath2);
}

$targetDir3= "folder/pda-semakan/sijil_spm/";
if(isset($_FILES['sijilspm'])){
     $fileName3 = $_FILES['sijilspm']['name'];
 $targetFilePath3 = $targetDir3 . $fileName3;
$move4 =move_uploaded_file($_FILES["sijilspm"]["tmp_name"], $targetFilePath3);
}



$query1=("UPDATE semakan_dokumen set student_id='$noMatrik', email= '$stdEmail', surat_tawaran='$fileName', ic='$fileName1',sijil_lahir='$fileName2',sijil_spm= '$fileName3' where email= '$stdEmail'");

 

You're overwriting the filename columns in your query. Make your code not overwrite those columns unless it has a new value.

By the way, if there's a new file, what do you do with the old one?

Not getting the impression that you read my reply.

Are the files still there after the first submit? They only disappear after the update? Did you try to upload new files in your update?

And once again: given that this update code can overwrite old files with new files, what are you doing with the old files? Do they need to be deleted?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.