Advertisement
Guest User

Untitled

a guest
Sep 21st, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. const [picture,setPicture] = useState('')
  2. const [pictureUrl,setPictureUrl] = useState('')
  3.  
  4.  
  5. // handle picture display
  6. const displayPicture = (e) => {
  7. let reader = new FileReader();
  8. let file = e.target.files[0]
  9. reader.onloadend = ()=> {
  10. setPicture(file)
  11. setPictureUrl(reader.result)
  12. }
  13. if (file){
  14. reader.readAsDataURL(file);
  15. }
  16. };
  17.  
  18. const sendPicture = ()=> {
  19. storage.child(`cooker/cookerBusinessImages/${new Date().getTime()}`).put(picture).then(console.log)
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement