Skip to content

Commit 782123b

Browse files
committed
Correct functionality
1 parent 83db901 commit 782123b

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

upload/tutorial-uploads.html

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,35 @@
88

99
<body>
1010
<div style="text-align: center;">
11-
1211
<h1>Tutorial Uploads</h1>
1312
<p>Upload your video tutorials here. They are uploaded to the 'training' folder of the 'cloudinary' product environment.</p>
1413
<button id="upload_widget" class="cloudinary-button">Upload Video</button>
1514
<p id="thanks"></p>
1615
<p id="publicId"></p>
17-
1816
</div>
17+
1918
<script type="text/javascript">
2019
var myWidget = cloudinary.createUploadWidget({
2120
cloudName: 'cloudinary',
2221
uploadPreset: 'auto-tutorial',
2322
sources: ["local", "url", "dropbox", "google_drive"],
2423
clientAllowedFormats: ["video"]
2524
}, (error, result) => {
26-
if (!error && result && result.event === "success") {
25+
if (error) {
26+
console.error("Upload Error:", error);
27+
return;
28+
}
29+
30+
// Ensure we only handle the "success" event
31+
if (result.event === "success") {
32+
console.log("Upload Successful:", result.info); // Log full details
33+
34+
// Extract and display the public ID
2735
document.getElementById("thanks").innerText = "Thank you!";
28-
document.getElementById("publicId").innerText = `Public ID: ${result.public_id}`;
29-
console.log(result);
36+
document.getElementById("publicId").innerText = `Public ID: ${result.info.public_id}`;
3037
}
31-
}
32-
)
38+
});
39+
3340
document.getElementById("upload_widget").addEventListener("click", function () {
3441
myWidget.open();
3542
}, false);

0 commit comments

Comments
 (0)