บทความ

กำลังแสดงโพสต์จาก สิงหาคม, 2020

Ajax by FormData for upload file

  วันนี้ผมได้ทำการใช้งาน ajax สำหรับ upload file ปรากฎว่า การใช้งาน  .serialize() Encode a set of form elements as a string for submission. ไม่สามารถได้รับข้อมูล File ที่เราอัพโหลดมาใน controller ได้  สุดท้ายผมก็ได้วิธีแก้ปัญหาดังนี้ function upLoadFileAjax () { showLoading () ; var url = '/api/reconciles/upload-file' ; var form = $ ( '#frm_upload_file' )[ 0 ] ; var data = new FormData(form) ; $. ajax ({ type : 'POST' , data : data , url : url , enctype : 'multipart/form-data' , processData : false , // Important! contentType : false , cache : false , headers : { 'X-CSRF-TOKEN' : $ ( ' meta [ name ="csrf-token"]' ). attr ( 'content' ) , 'Accept' : 'application/json' , } , ขอบคุณ cr.   https://mkyong.com/jquery/jquery-ajax-submit-a-multipart-form/

Command #1

test queue php artisan queue:work --queue=default  curl benchmark load test      ab -k -n 100 -c 10 http://api-order.eggsmartpos.loc:8302/v1/payment/charge  install redis composer require predis/predis self to api using  tail -f storage/ tail -f /var/log/  tail -f /var/log/nginx/ tail -f /var/log/nginx/app.access.log  install ping apt update  apt install  iputils- ping #upload size max cd /usr/local/etc/php cp php.ini-development php.ini  #kill nodes ps -ef kill -9 <pid ของ nodejs> #redis  redis-cli monitor redis-cli FLUSHALL var_dump( $this ->redis->hGetAll( $key )) ;die; kill -9 $(lsof -t -i tcp:9000)

Redis Command

        คำสั่งสำหรับ moniter ดู Redis ใน terminal ของเรา redis-cli monitor   : คำสั่งสำหรับ moniter ดูใน terminal ของเรา redis-cli FLUSHALL :   คำสั่งสำหรับ remove ข้อมูลใน redis ทั้งหมดของเรา คำสั่งสำหรับ remove volume docker ใน horeca plateform docker volume rm redis-datas                       สำหรับการลบ key ที่คล้ายกันในกลุ่มที่เราจัดการไว้ เราสามารถทำการลบได้ดังนี้ ในการตั้งชื่อ key => {ตัวแปรที่1} : {ตัวแปรที่ 2}  เราสามารถลบข้อมูลทั้งในในตัวแปรที่ 1 ได้โดย    Redis::del(Redis::keys( 'products:*' ))