Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solved File Management Exceptions #7390

Merged
Merged
Changes from 2 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
6 changes: 3 additions & 3 deletions src/Components/Patient/FileUpload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -905,11 +905,11 @@ export const FileUpload = (props: FileUploadProps) => {
}

const onFileChange = (e: ChangeEvent<HTMLInputElement>): any => {
if (e.target.files == null) {
throw new Error("Error finding e.target.files");
if (e.target.files == null || e.target.files.length === 0) {
rithviknishad marked this conversation as resolved.
Show resolved Hide resolved
return;
}
const f = e.target.files[0];
const fileName = f.name;
const fileName = f ? f.name : Date.now().toString(); // use timestamp as filename for unnamed files
rithviknishad marked this conversation as resolved.
Show resolved Hide resolved
setFile(e.target.files[0]);
setUploadFileName(
fileName.substring(0, fileName.lastIndexOf(".")) || fileName
Expand Down
Loading