[英]Attach Image to the input of type file using javascript
我希望用戶從網絡攝像頭拍照或上傳照片。 如果他選擇拍照,它應該加載uploadFile。 即使這是可能的,我也不知道。 我願意接受建議。
//I have an image
<img id="photo"> // I am getting this from webcam
//And I have an input of type file upload
<input type="file" name="uploadedFile" id="uploadedFile" accept="image/*">
// Now this image data in photo should go to uploadedFile. Is it possible?
這是不可能的。
您可以將數據編碼為文本(例如base64)並將其存儲在隱藏輸入中,也可以使用XMLHttpRequest對象而不是表單提交將其發送到服務器。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.