Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
@j-lamberts/react-file-upload
Advanced tools
This packages provides some easy-to-use react components for file uploads. It contains
FileUploader
to manage all uploadsFileDropzone
as a simple dropzone wrapper-componentFileSelect
as a simple wrapper around <input type="file" />
import {
Button,
Icon,
LinearProgress
} from 'material-ui';
import * as React from 'react';
import {
FileDropzone,
FileSelect,
FileUploader
} from 'react-file-uploads';
export default () => (
<FileUploader
keepOnFinish={true}
url={'http://localhost:4005/files'}
>
{({ handleFiles, queue }) => (
<div>
<FileDropzone onDrop={handleFiles}>
{queue.map((el, index) => (
<div key={index}>
{index} {el.name}
<LinearProgress
variant={el.progressTotal
? 'determinate'
: 'indeterminate'}
value={el.progressLoaded / el.progressTotal * 100}
/>
</div>
))}
DROP FILES HERE
</FileDropzone>
<div>
Uploaded: {queue.length} <br/>
Waiting: {queue.filter(el => !el.ready).length}<br/>
Ready: {queue.filter(el => el.ready).length}
</div>
<FileSelect
onChange={handleFiles}
multiple={true}
>
<Icon>file_upload</Icon>Upload
</FileSelect>
</div>
)}
</FileUploader>
);
import {
Button,
Icon,
LinearProgress
} from 'material-ui';
import * as React from 'react';
import {
FileDropzone,
FileSelect,
FileUploader
} from 'react-file-uploads';
export default () => (
<FileUploader
runManual={true}
keepOnFinish={true}
url={'http://localhost:4005/files'}
>
{({ handleFiles, queue, runManual }) => (
<div>
<!--- as above -->
<Button onClick={runManual}>
<Icon>check</Icon> Run
</Button>
</div>
)}
</FileUploader>
);
Name | Type | Default | Description |
---|---|---|---|
url * | string | (required) | HTTP-URL |
children * | (props: FileUploaderChildrenProps) => React.ReactNode | (required) | child-component |
runManual | boolean | false | Don't run upload on handleFiles() - use runManual instead |
keepOnFinish | boolean | false | Keep uploaded files in queue |
fieldName | string | 'file' | Form-Field |
method | 'POST' / 'PATCH' / 'PUT' | 'POST' | HTTP-Method |
headers | Object | {} | HTTP-Headers |
interface FileUploaderChildrenProps {
handleFiles: ((list: File[]) => void);
queue: FileUpload[];
runManual: () => void
}
interface FileUpload {
progressTotal: number;
progressLoaded: number;
error: boolean;
ready: boolean;
upload: XHRUpload; // don't access directly
name: string;
}
Name | Type | Default | Description |
---|---|---|---|
onDrop * | (files: File[]) => void | (required) | handler function |
children * | React.ReactNode ; | (required) | |
className | string | undefined | |
classNameActive | string | undefined | class-name on dragActive |
style | React.CSSProperties | undefined |
Name | Type | Default | Description |
---|---|---|---|
onChange: (files: File[]) => void | (required) | handler function | |
children | React.ReactNode | (required) | |
multiple | boolean | false | |
className | string | undefined | |
style | React.CSSProperties | undefined |
FAQs
File uploader for react.
We found that @j-lamberts/react-file-upload demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.