add direnv
This commit is contained in:
@ -133,20 +133,19 @@ pub fn Upload() -> Element {
|
||||
}
|
||||
} }
|
||||
|
||||
input { id: "file", r#type : "file" ,multiple: true, class : "hidden", oninput: move |e| async move {
|
||||
for file in e.files() {
|
||||
selected.with_mut(|files| {files.push((file.name(), byte_to_human_size(file.size()), None)); } );
|
||||
let idx = selected().len() - 1;
|
||||
|
||||
if (file.size() > UPLOAD_SIZE_LIMIT) {
|
||||
//messy but firefox can't handle when server returns early
|
||||
selected.with_mut(|files| { files[idx].2 = Some(HttpError::payload_too_large("This file is too large")) });
|
||||
continue;
|
||||
}
|
||||
|
||||
let res = upload_file(file.clone().into()).await;
|
||||
selected.with_mut(|files| { files[idx].2 = Some(res) });
|
||||
input { id: "file", r#type : "file" ,multiple: false, class : "hidden", oninput: move |e| async move {
|
||||
let file = &e.files()[0];
|
||||
selected.with_mut(|files| {files.push((file.name(), byte_to_human_size(file.size()), None)); } );
|
||||
let idx = selected().len() - 1;
|
||||
|
||||
if (file.size() > UPLOAD_SIZE_LIMIT) {
|
||||
//messy but firefox can't handle when server returns early
|
||||
selected.with_mut(|files| { files[idx].2 = Some(HttpError::payload_too_large("This file is too large")) });
|
||||
return ;
|
||||
}
|
||||
|
||||
let res = upload_file(file.clone().into()).await;
|
||||
selected.with_mut(|files| { files[idx].2 = Some(res) });
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user