ainbila Posted July 13, 2021 Share Posted July 13, 2021 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'"); Quote Link to comment https://forums.phpfreaks.com/topic/313382-update-upload-file-error-file-upload-during-insert-is-disappear/ Share on other sites More sharing options...
requinix Posted July 13, 2021 Share Posted July 13, 2021 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? Quote Link to comment https://forums.phpfreaks.com/topic/313382-update-upload-file-error-file-upload-during-insert-is-disappear/#findComment-1588321 Share on other sites More sharing options...
ainbila Posted July 13, 2021 Author Share Posted July 13, 2021 in my system , user can upload later other files in update menu .But it seems , the files that upload during first submit or insert form was gone .And only files during update later is remain. Quote Link to comment https://forums.phpfreaks.com/topic/313382-update-upload-file-error-file-upload-during-insert-is-disappear/#findComment-1588323 Share on other sites More sharing options...
requinix Posted July 14, 2021 Share Posted July 14, 2021 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? Quote Link to comment https://forums.phpfreaks.com/topic/313382-update-upload-file-error-file-upload-during-insert-is-disappear/#findComment-1588325 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.