
Security News
Official Go SDK for MCP in Development, Stable Release Expected in August
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
react-images-uploading
Advanced tools
A simple images uploader without UI. Building by yourself.
npm install --save react-images-uploading
import * as React from "react";
import ImageUploading from "react-images-uploading";
// { ImageUploadingPropsType, ImageListType, ImageType } is type for typescript
const maxNumber = 10;
const maxMbFileSize = 5;
class Example extends React.Component {
onChange = (imageList) => {
// data for submit
console.log(imageList);
};
render() {
return (
<ImageUploading
onChange={this.onChange}
maxNumber={maxNumber}
multiple
maxFileSize={maxMbFileSize}
acceptType={["jpg", "gif", "png"]}
>
{({ imageList, onImageUpload, onImageRemoveAll }) => (
// write your building UI
<div>
<button onClick={onImageUpload}>Upload images</button>
<button onClick={onImageRemoveAll}>Remove all images</button>
{imageList.map((image) => (
<div key={image.key}>
<img src={image.dataURL} />
<button onClick={image.onUpdate}>Update</button>
<button onClick={image.onRemove}>Remove</button>
</div>
))}
</div>
)}
</ImageUploading>
);
}
}
...
{({ imageList, onImageUpload, onImageRemoveAll, errors }) => (
<div>
{errors.maxNumber && <span>Number of selected images exceed maxNumber</span>}
{errors.acceptType && <span>Your selected file type is not allow</span>}
{errors.maxFileSize && <span>Selected file size exceed maxFileSize</span>}
</div>
)}
...
parameter | type | options | default | description |
---|---|---|---|---|
multiple | boolean | false | Set true for multiple choose | |
maxNumber | number | 1000 | Number of images user can select if mode = "multiple" | |
onChange | function | Called every update | ||
defaultValue | array | [{dataURL: ... }, ...] | Init data | |
acceptType | array | ['jpg', 'gif', 'png'] | [] | Supported image extension |
maxFileSize | number | Max image size(Mb) (will use in the image validation) |
parameter | type | description |
---|---|---|
imageList | array | List of images for render. Each item in imageList has some options below. |
imageList[index].key | string | Generate filename |
imageList[index].dataURL | string | Url image or base64 |
imageList[index].onUpdate | function | Call function for replace a new image on current position |
imageList[index].onRemove | function | Call function for remove current image |
onImageUpload | function | Call for upload new image(s) |
onImageRemoveAll | function | Call for remove all image(s) |
errors | object | Export type of validation |
FAQs
The simple images uploader applied Render Props pattern. This approach allows you to fully control UI component and behaviours.
The npm package react-images-uploading receives a total of 19,829 weekly downloads. As such, react-images-uploading popularity was classified as popular.
We found that react-images-uploading demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.
Security News
New research reveals that LLMs often fake understanding, passing benchmarks but failing to apply concepts or stay internally consistent.
Security News
Django has updated its security policies to reject AI-generated vulnerability reports that include fabricated or unverifiable content.