Skip to main content
CodeDeveloperOM
Inspiring
April 11, 2021
질문

imageUpload in movieclip

  • April 11, 2021
  • 1 답변
  • 585 조회

where is the problem Attached file for my project

 

https://drive.google.com/file/d/1wFPRy-hXRpoHvqFV9CtCQFfjlcfn5M4a/view?usp=sharing

 

    // Grabbing Elements and Storing in Variables
const defaultFile = document.getElementById("default-file");
const customBtn = document.getElementById("custom-btn");
const customSpace = document.getElementById("custom-space");


this.customBtn.addEventListener("click", fl_MouseClickHandler.bind(this));
function fl_MouseClickHandler() {
    this.defaultFile();
}


this.defaultFile.addEventListener("change", defaultFile1.bind(this));
function defaultFile1() {
    if (defaultFile.value) {
        customSpace.innerHTML =
            this.defaultFile.value.match(/[\/\\]([\w\d\s\.\-\(\)]+)$/)[1];
    } else {
        this.customSpace.innerHTML = "No File, Selected!";
    }

    const files = defaultFile.files[0];


    if (files) {
        const fileReader = new FileReader();
}

    this.fileReader.addEventListener("load", function () {
        this.preview_img.setAttribute("src", this.result);
        this.console.log(this.result);
    });
    this.fileReader.readAsDataURL(files);
}

 

이 주제는 답변이 닫혔습니다.

1 답변

kglad
Community Expert
Community Expert
April 11, 2021

have you created those elements (with js code or by adding to the html document)?

CodeDeveloperOM
Inspiring
April 29, 2021

@kglad adding to the html document ? why ?

Can you help me, genius?

avid_body16B8
Legend
April 29, 2021

You can actually stop having the js code published within the html file and have the js generated separately. You can also change the code in the html file,