전체 글136 [JavaScript] 드롭존 파일 용량 제한하기 MAX_FILE_SIZE 부분에 원하는 파일 사이즈를 넣으면된다. (바이트 단위) ref : https://docs.dropzone.dev/configuration/basics 2023. 8. 25. [Javascript] 드롭존 파일 용량 표기 방식 변경 Dropzone.prototype.filesize = function (bytes) { let selectedSize = 0; let units = ['B', 'KB', 'MB', 'GB', 'TB']; var size = bytes; while (size > 1024) { selectedSize = selectedSize + 1; size = size / 1024; } return "" + Math.trunc(size * 100) / 100 + " " + units[selectedSize]; } 기본 용량 계산방식이 10진수(1000)로 되어있어, 업로드 시 실제 용량보다 커보이게 됩니다. 이를 2진수(1024)로 변경하여 실제 용량과 차이가 없게 해주는 코드입니다. ref : https://stack.. 2023. 8. 24. [PostgreSQL] 트리거 생성하기 CREATE FUNCTION updatePop() RETURNS TRIGGER AS $updatePopulation$ DECLARE name1 varchar(30); name2 varchar(30); BEGIN IF (TG_OP = 'INSERT') THEN name1 = NEW.name; name2 = NEW.province; UPDATE Place SET population = population + 1 WHERE name1 = Place.name AND name2 = Place.province; END IF; RETURN NULL; END; $updatePopulation$ LANGUAGE plpgsql; CREATE TRIGGER updatePopulation AFTER INSERT ON Live.. 2023. 8. 24. [jQuery] Ajax 에러 핸들링 $.ajax({ type: "post", url: "/SomeController/SomeAction", success: function (data, text) { //... }, error: function (request, status, error) { alert(request.responseText); } }); request.responseText로 custom message를 받을 수 있습니다. ref : https://stackoverflow.com/questions/377644/jquery-ajax-error-handling-show-custom-exception-messages 2023. 8. 23. 이전 1 2 3 4 5 6 7 ··· 34 다음