สอบถามปัญหา การใช้ setTimeout

เริ่มโดย chabkbthai, 01 สิงหาคม 2019, 17:18:42

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

chabkbthai

มีปัญหาสอบถามครับ เรื่องมีอยู่ว่า ผมทำระบบบันทึกข้อมูลไฟล์  ปัญหาที่เกิดขึ้นคือ มันมีการตั้งค่า setTimeout โดยผมจะสมมุติว่าผมอัพไฟล์ขนาด 10 MB ซึ่งok อัพได้ผ่าน แต่ถ้าผมมีไฟล์ขนาดใหญ่เช่น1 GBแล้วต้องการอัพ เหมือนมันจะหมดเวลาในการอัพไฟล์แล้วบราวเซอร์ก็ขึ้นหน้าจอดำ อยากสอบถามว่าเราจะมีวิธีแก้ไขอยางไรให้มัน auto เองโดยประมาณว่าไม่ต้องใช้ setTimeout จับเวลา แต่ให้มันรอจนเสร็จไปเอง  ผมลองลบฟังก์ชั้นออกไปแล้ว ระบบมันจะไม่ทำงาน  เหมือนหยุดค้างที่ showMessage    พอจะเข้าใจสิ่งที่ผมอธิบายไหมครับ ยังไงรบกวนผู้รู้หน่อยครับ ว่าควคหาทางออกยังไง นี้เป็นโค๊ดบ้างส่วนนะครับ


//---------------------------------------------------------
               //-- Validación campo file_02 - CERTIFICADO
               var files_02 = $('#file_02')[0].files;
               if (files_02.length === 0) {
                   showError("กรุณาเลือกไฟล์ด้วย!!");
                   return;
               }

               file_02 = files_02[0];
               if (file_02.size > 1024 * 1024 * 10240) {
                   showError("ไฟล์ของคุณขนาดใหญ่เกิดไป กรุณาเลือกไฟล์ไม่เกิด 1TB.");
                   return;
               }

             
               
               //---------------------------------------------------------
               //-- Validación uso de datos
               var my_checkbox = $('input#checkbox_id').prop('checked');                
               if (my_checkbox == false) {
                   showError("Debe aceptar lo establecido en la política de uso de datos personales");
                   return;
               }
               
               showMessage2("กำลังบันทึกไฟล์ ...");
               setTimeout(submitForm_02, 2000);
                 
           }  
                       

           
           function submitForm_02() {
               showMessage2("รอข้อความยืนยัน...");
               //---------------------------------------------------------                
               reader_02.readAsDataURL(file_02);
               //---------------------------------------------------------
           }

           function showError(e) {
               $('#progress').addClass('red-text').html(e);
               $('#progress2').removeClass('red-text').html('');
               console.log("Error " + e);
           }

           function showMessage(e) {                
               $('#progress').removeClass('red-text').html(e);
               console.log("Message_01: " + e);                
           }

           function showMessage2(e) {
               $('#progress2').removeClass('red-text').html(e);
               console.log("Message_02: " + e);                
           }
           
           function timed_submitForm_02() {
               if ( my_temp_01 == null) {                    
                   setTimeout(timed_submitForm_02, 1000);
               }
               else {
                   console.log('-----------------------------');
                   console.log('Uploading.. File_02');
                   
                   setTimeout(submitForm_02, 200);
               }
           }

           function custom_submit() {
               
               showError('');
               showMessage('');
               showMessage2('');

               console.clear();
               console.log('-----------------------------');
               console.log("%cFormulario", "color: blue; text-transform: uppercase");
               console.log('-----------------------------');
               var folderName = "Entregas Convocatoria";

               showMessage2("Tramitando solicitud ...");
               google.script.run.createFolder_01(folderName, $('input#name').val(), $('input#id_number').val());
               
               setTimeout(submitForm_00, 0);
           }

       </script>

snookerpk


chabkbthai

อ้างถึงจาก: GO-SOLUTION ใน 02 สิงหาคม 2019, 08:25:29
ลองเข้าไปเปลี่ยนค่าใน php.ini ดูครับ

ค้นหาคำสั่ง
memory_limit
upload_max_size
upload_max_filesize
max_execution_time

   

ยังไม่ได้ครับ

watyai

ต้องใช้วิธีการทะยอยอัพ ทะย้อยเก็บ ถ้าไฟล์ใหญ่มากๆ
ไปคนข้อมูลต่อนะไกด์ ให้ประมาณนี้ก่อน
https://www.mjform.com/ Component Joomla สร้างฟอร์ม แค่ลากวาง
https://www.mooziicart.com มีใครทำเว็บขายของฟรี

kaeiji


CherryX

อ้างถึงจาก: GO-SOLUTION ใน 02 สิงหาคม 2019, 08:25:29
ลองเข้าไปเปลี่ยนค่าใน php.ini ดูครับ

ค้นหาคำสั่ง
memory_limit
upload_max_size
upload_max_filesize
max_execution_time

   

ขอเก็บข้อมูลด้วย ขอบคุณค่ะ  :wanwan017:
***ลายเซ็นสูงเกินขนาด