diff options
Diffstat (limited to 'src/mobile/ImageUpload.tsx')
-rw-r--r-- | src/mobile/ImageUpload.tsx | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/mobile/ImageUpload.tsx b/src/mobile/ImageUpload.tsx index 9a9ea0693..ad589d51f 100644 --- a/src/mobile/ImageUpload.tsx +++ b/src/mobile/ImageUpload.tsx @@ -1,4 +1,4 @@ -import * as ReactDOM from 'react-dom'; +import * as ReactDOM from 'react-dom'; import React = require('react'); import "./ImageUpload.scss" import { action, runInAction } from "mobx"; @@ -7,37 +7,37 @@ import { action, runInAction } from "mobx"; const onPointerDown = (e: React.TouchEvent) => { - let imgInput = document.getElementById("input_image_file"); - if (imgInput){ - imgInput.click(); + let imgInput = document.getElementById("input_image_file"); + if (imgInput) { + imgInput.click(); } } -const onFileLoad = (file:any) => { - let img = new Image(); +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){ + if (imgPrev) { + let files = file.target.files; + if (files.length != 0) { console.log(files[0]); - console.log(window.location.origin) + console.log(window.location.origin) const upload = window.location.origin + "/upload"; - let formData = new FormData(); + 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(( - <div className = "imgupload_cont"> - <button className = "button_file" onTouchStart = {onPointerDown}> Open Image </button> - <input type= "file" accept = "image/*" capture="camera" onChange = {onFileLoad} className = "input_file" id = "input_image_file"></input> - <img id = "img_preview" src = ""></img> + <div className="imgupload_cont"> + <button className="button_file" onTouchStart={onPointerDown}> Open Image </button> + <input type="file" accept="image/*" capture="filesystem" onChange={onFileLoad} className="input_file" id="input_image_file"></input> + <img id="img_preview" src=""></img> </div>), document.getElementById('root') );
\ No newline at end of file |