
ainbila
Members-
Posts
25 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
ainbila's Achievements

Member (2/5)
0
Reputation
-
i try this code to rename file when upload , the file name is rename in the folder or physical file .But in the database , it display 'array' not the name of file .How to save file name in the database ? $targetDirg= "folder/pda-semakan/gambar/"; if($_FILES['gambar']['size'] == 0 && $_FILES['gambar']['name'] == ""){ $fileNameg = $gambar; }else{ $fileNameg =explode(".",$_FILES['gambar']['name']); $newfilename= $stIC.'.'.end($fileNameg); $moveg =move_uploaded_file($_FILES["gambar"]["tmp_name"], $targetDirg.$newfilename); }
-
Thank you . Do you know if there have code for reupload file in php ?
-
because we need to limit the file size as our server is not too big . The user need to upload multiple file .so , we currenly have problem when user upload file too big and it slower our server
-
how to put code for check file size before upload in the if issertfile .the file is in format pdf or docs $targetDirg= "folder/pda-semakan/gambar/"; if(isset($_FILES['gambar'])){ $fileNameg = $_FILES['gambar']['name']; $targetFilePathg = $targetDirg . $fileNameg; //$main_tmp1 = $_FILES['surat']['tmp_name']; $moveg =move_uploaded_file($_FILES["gambar"]["tmp_name"], $targetFilePathg); }
-
Auto compress when upload file pdf in php
ainbila replied to ainbila's topic in Other Programming Languages
because our server size is limited so i need to make sure file not to big size -
is there any way to put function compress pdf file size in this code . Because when user upload big file size , it will get error . So , i'm looking code that can auto resize the pdf file in php $targetDir7= "folder/pda-semakan/bm/"; if(isset($_FILES['bmjulai'])){ $fileName7= $_FILES['bmjulai']['name']; $targetFilePath7 = $targetDir7 . $fileName7; $move8=move_uploaded_file($_FILES["bmjulai"]["tmp_name"], $targetFilePath7); }
-
Update upload file error , file upload during insert is disappear
ainbila replied to ainbila's topic in PHP Coding Help
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. -
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'");
-
i have error where my code should update existing data where id exist, it get updated ..but the others data is disappeared .only the data updated is remained $sql1 ="select*from semakan_dokumen where email='$stdEmail'"; $sqlsearch1 = mysqli_query($dbconfig,$sql1); $resultcount1 = mysqli_num_rows($sqlsearch1); if($resultcount1 > 0){ $query1=("UPDATE semakan_dokumen set student_id='$noMatrik', email= '$stdEmail', surat_tawaran='$fileName', ic='$fileName1',sijil_lahir='$fileName2',sijil_spm= '$fileName3',sijil_sekolah= '$fileName4', sijil_dip= '$fileName5',sej_julai='$fileName6',bm_julai='$fileName7',muet='$fileName8', mid1='$fileName9',yuran= '$fileName10',umpa_bend1= '$fileName11',umpa_bend2='$fileName12',bpkp='$fileName13', penaja='$fileName14',kesihatan= '$fileName15', jhepa='$fileName16' where email= '$stdEmail' "); }else{ //filezip $query1 = "INSERT INTO semakan_dokumen (email,surat_tawaran,ic,sijil_lahir,sijil_spm,sijil_sekolah,sijil_dip,sej_julai,bm_julai,muet,mid1,yuran,umpa_bend1,umpa_bend2,bpkp,penaja,kesihatan,jhepa) VALUES ('$stdEmail','$fileName','$fileName1','$fileName2','$fileName3','$fileName4','$fileName5','$fileName6','$fileName7','$fileName8','$fileName9','$fileName10','$fileName11','$fileName12','$fileName13','$fileName14','$fileName15','$fileName16')"; }
-
hi , i want to disable or hide the submit button after user submit and just display the update button .My problem is this form in form of tab by tab .so i dont know how to disable the button button javascript $('#btn_confirmation1').click(function(){ $('#btn_confirmation1').attr("disabled", true); $(document).css('cursor', 'prgress'); $("#application-form1").submit(); return true; }); form (all in one page) <form id="application-form1" action="save_form_semakan.php" method="POST" enctype="multipart/form-data"> <!--tab nav tabs--> <?php include 'nav_tabs1.php';?> <div class="tab-content" style="margin-top:16px;"> <!--tab application guideline--> <?php include ("tab_semak1.php")?>
-
hi , i have an error in my php . It will display successful only if all file being upload , if there have one file not upload . it go to blankpage not tell any error or success.I have file that being upload to different path folder $fileName14 = basename($_FILES["penaja"]["name"]); $targetFilePath14=$targetDir14. $fileName14; $fileType14 = pathinfo($targetFilePath14,PATHINFO_EXTENSION); $allowTypes14= array('pdf','PDF','docx','DOCX'); //kesihatan $targetDir15 ="folder/pda-semakan/kesihatan/"; $fileName15 = basename($_FILES["umpapkp"]["name"]); $targetFilePath15=$targetDir15. $fileName15; $fileType15 = pathinfo($targetFilePath15,PATHINFO_EXTENSION); $allowTypes15= array('pdf','PDF','docx','DOCX'); //jhepa $targetDir16 ="folder/pda-semakan/jhepa/"; $fileName16 = basename($_FILES["umpajhepa"]["name"]); $targetFilePath16=$targetDir16. $fileName16; $fileType16 = pathinfo($targetFilePath16,PATHINFO_EXTENSION); $allowTypes16= array('pdf','PDF','docx','DOCX'); if(in_array($fileTypeg, $allowTypesg)){ if(in_array($fileType, $allowTypes)){ if(in_array($fileType1, $allowTypes1)){ if(in_array($fileType2, $allowTypes2)){ if(in_array($fileType3, $allowTypes3)){ if(in_array($fileType4, $allowTypes4)){ if(in_array($fileType5, $allowTypes5)){ if(in_array($fileType6, $allowTypes6)){ if(in_array($fileType7, $allowTypes7)){ // Upload file to server if(move_uploaded_file($_FILES["gambar"]["tmp_name"], $targetFilePathg)){ if(move_uploaded_file($_FILES["surat"]["tmp_name"], $targetFilePath)){ if(move_uploaded_file($_FILES["ic"]["tmp_name"], $targetFilePath1)){ if(move_uploaded_file($_FILES["sijilkelahiran"]["tmp_name"], $targetFilePath2)){ if(move_uploaded_file($_FILES["sijilspm"]["tmp_name"], $targetFilePath3)){ if(move_uploaded_file($_FILES["sijilberhenti"]["tmp_name"], $targetFilePath4)){ if(move_uploaded_file($_FILES["sijilmatrik"]["tmp_name"], $targetFilePath5)){ if(move_uploaded_file($_FILES["sejulai"]["tmp_name"], $targetFilePath6)){ if(move_uploaded_file($_FILES["bmjulai"]["tmp_name"], $targetFilePath7)){
-
the symbol is gone now . but how to remove the space ? SELECT IFNULL(race_id,''), IFNULL(race_code,''), IFNULL(ptmk_race_code,''),IFNULL(race_name,''),IFNULL(keyin_by,''),IFNULL(keyin_date,'') INTO OUTFILE 'pp.txt' FIELDS TERMINATED by '' from race the data should follow the row value like in the db structure like : race_id (1-11) race_code(12-31) now the output include many spaces :
-
hi everyone ,i export data from table in phpmyadmin to txtfile SELECT * FROM employees INTO OUTFILE '/tmp/test.txt' FIELDS TERMINATED BY ',' ENCLOSED BY '"' ESCAPED BY "" LINES TERMINATED BY ' '; there is some problem 1) i dont want the symbol 2) i want to keep column value when user not enter any value follow database structure between chia jun and date there is space because there have some column . for example like in the image
-
hi barand ,can you check my if else .there something wrong .the calculation is right actually
-
i'm sorry if (($sub == 'SNT') || ($sub == 'LKJ') || ($sub == 'GRA') || ($sub == 'GKT') || ($sub == 'TEK') || ($sub == 'PJA') || ($sub == 'BIO') || ($sub == 'PJE') || ($sub == 'PJM') || ($sub == 'PSS') || ($sub == 'PEE') || ($sub == 'MUL') || ($sub == 'PDT') || ($sub == 'RKB') || ($sub == 'RT') || ($sub == 'SS')){ if ($res == 0) { $merit = 18; } if ($res == 1) { $merit = 16; } if ($res == 2) { $merit = 14; } if ($res == 3) { $merit = 12; } if ($res == 4) { $merit = 10; } if ($res == 5) { $merit = 8; } if ($res == 6) { $merit = 6; } if ($res == 7) { $merit = 4; } if ($res == 8) { $merit = 2; } if ($res == 9) { $merit = 0; } $main_add_merit = $merit; $k[$i] = $merit; rsort($k); $arrlength = count($k); for($x = 0; $x < 1; $x++) { $main_add_merit=$k[$x]; $main_add_merit; } } if ((($sub == 'BM') || ($sub == 'BI') || ($sub == 'SEJ') || ($sub == 'PQS') || ($sub == 'PSI')|| ($sub == 'BAT')|| ($sub == 'PI'))){ if ($res == 0) { $merit = 18; } if ($res == 1) { $merit = 16; } if ($res == 2) { $merit = 14; } if ($res == 3) { $merit = 12; } if ($res == 4) { $merit = 10; } if ($res == 5) { $merit = 8; } if ($res == 6) { $merit = 6; } if ($res == 7) { $merit = 4; } if ($res == 8) { $merit = 2; } if ($res == 9) { $merit = 0; } $main_add_merit1 = $merit; $s[$i] = $main_add_merit1; //echo '<br>'; rsort($s); echo '<pre>' . print_r( $s, true) . '</pre>'; $sum = array_sum(array_slice($s, 0, 3)); echo $sum; } } } there is error in my if else that got wrong subject. array_slice() also can be used for sum . i want to find 3 subject highest value ,the subject must be others than the first if else .