[PHP] Configuration for file upload

To upload file in PHP, there are several items to be configured. Otherwise the file not be to access in PHP or error will be return by nginx.

To upload file in PHP, there are several items to be configured. Otherwise the file not be to access in PHP or error will be return by nginx.

  1. Include the size limit of php
upload_max_filesize=16M
post_max_size=32M
  1. Increase the size limit of nginx
client_max_body_size 32M;

HotFix for bootstrap Modal

As bootstrap only support one `Modal` show as the same time. This snippets will help with close the old one.

As bootstrap only support one Modal show as the same time. This snippets will help with close the old one.

(function () {
    let deferredModal = null;
    $(document.body).on('show.bs.modal', '.modal', function (e) {
        let $modal = $('.modal.show').not(this);
        if ($modal.length > 0) {
            e.preventDefault();
            e.stopPropagation();
            deferredModal = this;
            $modal.modal('hide');
        }
    })
    .on('hidden.bs.modal', '.modal', function(){
        if (!deferredModal) {
            return;
        }
        $(deferredModal).modal('dispose').modal('show');
        deferredModal = null;
    });
})();

Pure native js copy2clipboard

snippets for copy text to clipboard

let input = document.createElement('input');
    document.body.appendChild(input);
    input.style.position = 'fixed';
    input.style.left = 0;
    input.style.right = 0;
    input.value = window.location.href;
    if (window.navigator.userAgent.match(/ipad|iphone|ipod/i)) {
        let range = window.document.createRange();
        let  selection = window.getSelection();
        range.selectNodeContents(input);
        selection.removeAllRanges();
        selection.addRange(range);
        input.readOnly = true;
        input.setSelectionRange(0, 999999);
        input.readOnly = false;
    } else {
        input.select();
    }
document.execCommand('copy');
input.remove();