From 94baa241afd3a99b233ae6197b7e404951347413 Mon Sep 17 00:00:00 2001 From: Andrew Kim Date: Sun, 17 Mar 2019 19:07:17 -0400 Subject: Updated ImageUpload --- src/mobile/ImageUpload.tsx | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'src/mobile') diff --git a/src/mobile/ImageUpload.tsx b/src/mobile/ImageUpload.tsx index 6e15b0802..9a9ea0693 100644 --- a/src/mobile/ImageUpload.tsx +++ b/src/mobile/ImageUpload.tsx @@ -1,6 +1,8 @@ import * as ReactDOM from 'react-dom'; import React = require('react'); import "./ImageUpload.scss" +import { action, runInAction } from "mobx"; + @@ -11,11 +13,31 @@ const onPointerDown = (e: React.TouchEvent) => { } } +const onFileLoad = (file:any) => { + let img = new Image(); + let imgPrev = document.getElementById("img_preview") + if (imgPrev){ + let files = file.target.files; + if (files.length != 0){ + console.log(files[0]); + console.log(window.location.origin) + const upload = window.location.origin + "/upload"; + let formData = new FormData(); + formData.append("file", files[0]); + console.log(window.location.origin + file[0]) + + //imgPrev.setAttribute("src", window.location.origin + files[0].name) + } + } + + +} + ReactDOM.render((
- - + +
), document.getElementById('root') ); \ No newline at end of file -- cgit v1.2.3-70-g09d2