티스토리 뷰
🎨 Dropzone - 이미지 & 파일 업로드 (드래그 앤 드롭) 라이브러리
Dropzone.js Dropzone.js는 프론트 페이지에서 사용하는 대표적인 파일 업로드 라이브러리이다. 기본적으로 드래그 앤 드롭 기능을 지원하며, 라이브러리 기본 스타일 또한 동적인 애니메이션과 고급
inpa.tistory.com
Introduction - Dropzone
Dropzone is a simple JavaScript library that helps you add file drag and drop functionality to your web forms. It is one of the most popular drag and drop library on the web and is used by millions of people.
docs.dropzone.dev
https://yeahvely.tistory.com/123
DropZone 썸네일에 버튼 추가하기
플러그인에 기본으로 있는 remove버튼을 사용해도 되었지만 버튼을 클릭해서 다른 이벤트를 주고 싶다던가 버튼의 css를 변경하고 싶은경우가 생겨 부득이하게 새로운 버튼을 생성하게 됨. 1. 먼
yeahvely.tistory.com
jquery 드래그 앤 드롭 파일 업로드
드래그 앤 드롭 파일 업로드 jquery 를 활용하여 드래그 앤 드롭 멀티 파일 업로드 기능을 구현해 보자 요즘 홈페이지들을 보면 파일을 업로드 할 때 예전처럼 파일탐색창에서 선택하여 업로드 할
cofs.tistory.com
https://askforyou.tistory.com/9
dropzone.js (드롭존) 드래그앤드롭 파일 업로드
진행하던 업무에 파일업로드 관련해서 UI 가 조금 변경을 하게 되었습니다. 검색을 해보니 많은 분 들이 dropzone 에 대해 많은 게시 글과 칭찬을 보게 되어 dropzone 훑어 보았습니다. https://www.dropzone
askforyou.tistory.com
#누군가가 만들어놓은 코드
$(document).ready(function() {
$(".file-dropzone").on('dragover', handleDragEnter);
$(".file-dropzone").on('dragleave', handleDragLeave);
$(".file-dropzone").on('drop', handleDragLeave);
function handleDragEnter(e) {
this.classList.add('drag-over');
}
function handleDragLeave(e) {
this.classList.remove('drag-over');
}
Dropzone.autoDiscover = false;
$('.dropzone').each(function() {
var id = $(this).attr('id');
var url = $(this).data('url');
$('div#' + id).dropzone({
url : url,
autoProcessQueue : true,
uploadMultiple : true,
maxFilesize : 256,
thumbnailWidth: 180,
thumbnailHeight: 120,
parallelUploads: 100,
maxFiles : 3,
addRemoveLinks : true,
acceptedFiles: ".jpeg,.jpg,.png,.gif,.JPEG,.JPG,.PNG,.GIF",
// The setting up of the dropzone
accept: function(file, done) {
done();
},
init : function() {
var myDropzone = this;
var count = myDropzone.options.maxFiles;
$.getJSON("./file/list.do", $("#"+id).find('input[type=hidden]')).done(function (data) {
$('#'+id).find('input[type=hidden]').remove();
if (data.data != '' && data.data != undefined) {
var existingFileCount = 0;
$.each(data.data, function (index, item) {
var mockFile = {
name: item.logicFileNm,
size: item.fileSize,
seq: item.fileId
};
myDropzone.emit("addedfile", mockFile);
myDropzone.emit("thumbnail", mockFile, item.filePath);
myDropzone.emit("success", mockFile);
myDropzone.files.push(mockFile);
existingFileCount = existingFileCount + 1;
});
myDropzone.options.maxFiles = myDropzone.options.maxFiles - existingFileCount;
}
});
this.on("maxfilesexceeded", function (file) {
alert('Max File Count : ' + count);
myDropzone.removeFile(file);
});
this.on("success", function( file, resp, formData ){
var type = $("#"+id).data("type");
if(resp != null && resp != undefined) {
if(resp.data != null && resp.data != '' && resp.data != undefined) {
var existingFileCount = 0;
$.each(resp.data, function(){
file.previewElement.appendChild(Dropzone.createElement("<input type='hidden' name='fileId' value='" + this.fileId + "'/>"));
existingFileCount = existingFileCount + 1;
});
}
}
if(file.seq != null && file.seq != '' && file.seq != undefined) {
file.previewElement.appendChild(Dropzone.createElement("<input type='hidden' name='fileId' value='" + file.seq + "'/>"));
}
});
this.on("removedfile", function (data) {
var id = $(data.previewElement).find('input[name=fileId]').val();
$.ajax({
url: './file/delete.do',
type: 'POST',
data: { 'fileId' : id }
});
myDropzone.options.maxFiles = myDropzone.options.maxFiles + 1;
if(count < myDropzone.options.maxFiles) myDropzone.options.maxFiles = count;
});
}
});
});
$('.push').click(function() {
$('.dropzone').each(function() {
});
});
});
'Language > JavaScript' 카테고리의 다른 글
Fiddler (0) | 2023.05.15 |
---|---|
스크립트로 테이블 자동 생성 (0) | 2023.05.15 |
JSON 문법 (0) | 2023.04.20 |
JSON 기본 (0) | 2023.04.20 |
FormData 기본 (0) | 2023.04.20 |
- Total
- Today
- Yesterday
- 역반복문
- 자료형
- IndexError
- 프로그램
- java.time.package
- 리스트연산자
- Math 클래스
- StringTokenizer 클래스
- Format 클래스
- Objects 클래스
- StringBuffer 클래스
- 기본 API 클래스
- 스레드 스케줄링
- 요소선택
- not_in
- 문자열함수
- 순환할당
- python
- Date 클래스
- 함수
- 파이썬
- Random 클래스
- 리스트
- 딕셔너리
- 포장 클래스
- Calendar 클래스
- Arrays 클래스
- StringBuilder 클래스
- FALSE
- Pattern 클래스
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |