Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/BootstrapBlazor/wwwroot/modules/upload.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import Data from "./data.js"
import EventHandler from "./event-handler.js"
import { readFileAsync } from "./utility.js"

export function init(id) {
const el = document.getElementById(id)
Expand Down Expand Up @@ -91,17 +90,14 @@ export function preview(previewerId, index) {
}
}

export async function getPreviewUrl(id, fileName) {
export function getPreviewUrl(id, fileName) {
let url = '';
const upload = Data.get(id);
const { files } = upload;
if (files) {
const file = [...files].find(v => v.name === fileName);
if (file) {
const data = await readFileAsync(file);
if (data) {
url = URL.createObjectURL(data);
}
url = URL.createObjectURL(file);
}
}
return url;
Expand Down
Loading