commit 601e9d364fd196705d0e833c776918049170fd0f Author: PhuocNTB Date: Wed Oct 8 09:27:27 2025 +0700 tt diff --git a/index.html b/index.html new file mode 100644 index 0000000..a2268ff --- /dev/null +++ b/index.html @@ -0,0 +1,17 @@ + + + + + + Document + + + file ban upload +
+ + +
+ + + + \ No newline at end of file diff --git a/main.js b/main.js new file mode 100644 index 0000000..614623e --- /dev/null +++ b/main.js @@ -0,0 +1,21 @@ +function upload(e) { + e.preventDefault() + + + let files = e.target.icon.files + + console.log("da vao", files[0]) + + let formData = new FormData() + formData.append("file", files[0]) + formData.append("upload_preset", "testpreset") + formData.append("cloud_name", "dusw32tsq") + + axios.post("https://api.cloudinary.com/v1_1/dusw32tsq/image/upload", +formData + ) + .then(res => { + console.log("thanh2 cong6", res) + document.querySelector("img").src = res.data.secure_url + }) +} \ No newline at end of file