본문 바로가기
IT 개발/JavaScript

[jQuery] fileDrop()

by Love of fate 2023. 4. 5.
728x90
반응형

파일을 dragDrop하여 끌어다 놓아 파일 업로드 할 때가 있는데 

jQuery의 fileDrop()을 사용하는 방법이 있다.

[활용 소스]

        $(`#dropZone`).filedrop({
            url: `https://example.com/upload/Upload.asp?uploadLocation=${uploadLocation}&filename=${filename}`,
            paramname: 'file1',
            maxfiles: 1,
            myFiles: files,
            rename: function() {
                return filename;
            },
            uploadFinished: function (i, file, response, time) {
                curImg=curDiv.find(`.prdimg`).attr(`src`,``);  curImg.attr(`src`,`https://seasonal.kickeepants.net/shop/pc/images/catalogcreation/${filename}?${Math.floor(Math.random()*1000)}`)
            }
        });

 

* 참고자료

https://github.com/weixiyen/jquery-filedrop

 

GitHub - weixiyen/jquery-filedrop: jQuery plugin - drag and drop desktop files and POST to a URL to handle files.

jQuery plugin - drag and drop desktop files and POST to a URL to handle files. - GitHub - weixiyen/jquery-filedrop: jQuery plugin - drag and drop desktop files and POST to a URL to handle files.

github.com

728x90
반응형