Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
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 mode = "single";
const maxNumber = 10;
class Example extends React.Component {
onChange = imageList => {
// data for submit
};
render() {
return (
<ImageUploading mode={mode} onChange={onChange} maxNumber={maxNumber}>
{({ 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>
);
}
}
parameter | type | options | default | description |
---|---|---|---|---|
mode | string | single/multiple | single | Select just one or multiple images |
maxNumber | number | 100 | Number of images user can select if mode = "multiple" | |
onChange | function | Called every update | ||
defaultValue | array | [{dataURL: ... }, ...] | Init data |
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) |
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 29,069 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.