Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- npm i react-filepond
- npm i filepond-plugin-image-exif-orientation --save
- npm i filepond-plugin-image-preview --save
- npm i filepond-plugin-file-encode --save
- ==================================
- import { FilePond, registerPlugin } from "react-filepond";
- import "filepond/dist/filepond.min.css";
- import FilePondPluginImageExifOrientation from "filepond-plugin-image-exif-orientation";
- import FilePondPluginImagePreview from "filepond-plugin-image-preview";
- import "filepond-plugin-image-preview/dist/filepond-plugin-image-preview.css";
- import FilePondPluginFileEncode from 'filepond-plugin-file-encode';
- ==================================
- <FilePond
- name="filePond"
- className="filePondStyle"
- allowFileEncode={true}
- files={this.files}
- allowMultiple={true}
- maxFiles={3}
- />
- ==================================
- collectImages = () => {
- let regexPattern = "{.*?data\":\"";
- let imagesForUpload = document.getElementsByName("filePond");
- Object.keys(imagesForUpload).map((arrayNumber) => {
- let data = imagesForUpload[arrayNumber].value;
- this.state.images.push(data.replace(new RegExp(regexPattern), ""));
- })
- }
- ==================================
- //inside constructor
- this.collectImages = this.collectimages.bind(this);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement