function uploadFiles(e) {
e.stopPropagation();
e.preventDefault();
e.dataTransfer = e.originalEvent.dataTransfer;
var files = e.target.files || e.dataTransfer.files;
console.log("업로드 완료" + files[0].name);
if (files.length > 1) {
alert("하나만 올려주세요");
return;
}
if(files[0].type.match(/image.*/)){
$(e.target).css({
"background-image" : "url(" + window.URL.createObjectURL(files[0]) + ")",
"outline" : "none",
"background-size" : "100% 100%"
});
}
}
이런 코드를 작성하면된다
이미지를 1개만 올리며 올릴시 해당영역에 css 를
올린이미지로 바꿔버림
'기능에대한 임시저장' 카테고리의 다른 글
SQL JOIN 정리 (0) | 2023.07.03 |
---|---|
[아주쉬운 배포툴] deta space 연습용 배포툴 사용 방법 Mac버전 (0) | 2023.07.03 |