
Security News
Deno 2.6 + Socket: Supply Chain Defense In Your CLI
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.
@idui/react-file-input
Advanced tools
npm install --save @idui/react-file-input
yarn add @idui/react-file-input
import React from 'react'
import FileInput, { UploadArea } from '@idui/react-file-input'
function Example() {
const [src, setSrc] = useState();
return <UploadArea>
<FileInput onChange={setValue} accept="image/*" />
{src ? <img alt="" src={src} /> : <span>Drop file here or click to upload</span>}
</UploadArea>
}
import React from 'react'
import FileInput, {UploadArea} from '@idui/react-file-input'
// if multiple then here would be files array
const upload = (file) => {
// should return Promise
return fetch('http://example.com', {
method: 'POST',
body: file
}).then(response => response.json().data.src)
};
function Example() {
const [src, setSrc] = useState();
const [isUploading, setUploading] = useState();
const handleChange = (newSrc) => {
setUploading(false);
setSrc(newSrc)
};
return <UploadArea>
<FileInput
accept="image/*"
onStartUploading={() => setUploading(true)}
onUpload={upload}
onChange={handleChange}
onError={() => setUploading(false)}
maxFileSize={10}
/>
{src ? <img alt="" src={src}/> : <span>Drop file here or click to upload</span>}
</UploadArea>
}
import React from 'react'
import styled from 'styled-components';
import FileInput from '@idui/react-file-input'
const CustomUploadArea = styled.div`
position: relative;
width: 15rem;
height: 15rem;
border-radius: 50%;
backgroun-color: orangered;
img {
height: 100%;
width: auto;
max-width: 100%;
}
`
function Example() {
const [src, setSrc] = useState();
return <CustomUploadArea>
<FileInput onChange={setValue} accept="image/*" />
{src && <img alt="" src={src} />}
</CustomUploadArea>
}
import React from 'react'
import FileInput, { UploadArea } from '@idui/react-file-input'
const DragUploadArea = styled(UploadArea)`
height: 40rem;
width: 60rem;
background-color: ${props => props.isDragging ? '#C7F9F1' : '#FFFFFF'};
`
export function DragAndDropExample({ onUpload, ...props }) {
const [value, setValue] = useState();
return (
<FileInput {...props} onChange={setValue} accept="image/*" >
{({ dragContainerProps, fileInput }) => <DragUploadArea {...dragContainerProps}>
{fileInput}
{value ? <img alt="" src={value} /> : <span>{dragContainerProps.isDragging ? 'Drop here' : 'Drop file here or click to upload'}</span>}
</DragUploadArea>}
</FileInput>
);
}
MIT © kaprisa57@gmail.com
FAQs
React FileInput Component
We found that @idui/react-file-input 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
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.