Package Exports
- multiple-files-loader
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (multiple-files-loader) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Multiple Files Loader
Ready to use uploader component
Features
- Multiple or single file loader
- Return array of attached files for working on
- Uploading files animation
Installation
npm i multiple-files-loaderUsing
- Component
<FileUploader
files={files}
onRemoveFile={handleRemoveFile}
onSelectFiles={handleSelectFile}
/>- Example of outer functions
const [files, setFiles] = useState([]);
const handleSelectFile = (filesArr) => {
const objArr = filesArr.map((file) => {
return {
name: file.name,
size: file.size,
type: file.type,
url: "https://file.com/file.pdf",
loading: false
};
});
setFiles(objArr);
};
const handleRemoveFile = (fileName) => {
setFiles(files.filter((file) => file.name !== fileName));
};