Advertisement
Guest User

Untitled

a guest
May 19th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. npm i react-filepond
  2. npm i filepond-plugin-image-exif-orientation --save
  3. npm i filepond-plugin-image-preview --save
  4. npm i filepond-plugin-file-encode --save
  5.  
  6. ==================================
  7.  
  8. import { FilePond, registerPlugin } from "react-filepond";
  9. import "filepond/dist/filepond.min.css";
  10. import FilePondPluginImageExifOrientation from "filepond-plugin-image-exif-orientation";
  11. import FilePondPluginImagePreview from "filepond-plugin-image-preview";
  12. import "filepond-plugin-image-preview/dist/filepond-plugin-image-preview.css";
  13. import FilePondPluginFileEncode from 'filepond-plugin-file-encode';
  14.  
  15. ==================================
  16.  
  17. <FilePond
  18. name="filePond"
  19. className="filePondStyle"
  20. allowFileEncode={true}
  21. files={this.files}
  22. allowMultiple={true}
  23. maxFiles={3}
  24. />
  25.  
  26. ==================================
  27.  
  28. collectImages = () => {
  29. let regexPattern = "{.*?data\":\"";
  30. let imagesForUpload = document.getElementsByName("filePond");
  31.  
  32. Object.keys(imagesForUpload).map((arrayNumber) => {
  33. let data = imagesForUpload[arrayNumber].value;
  34. this.state.images.push(data.replace(new RegExp(regexPattern), ""));
  35. })
  36. }
  37.  
  38. ==================================
  39.  
  40. //inside constructor
  41. this.collectImages = this.collectimages.bind(this);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement