0

I want the user to either take a picture from webcam or upload photo. If he chooses to take a picture, It should load in uploadedFile. I dont know even if this is possible at all. I am open to suggestions.

//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?
2
  • look into stackoverflow.com/questions/4998908/… Commented May 6, 2014 at 10:58
  • Thank you, That helped me to some extent. Still don't know how I can attach achieved blob to the input of type file. Commented May 7, 2014 at 7:55

1 Answer 1

2

It isn't possible.

You can either encode the data as text (eg. base64) and store it in a hidden input, or you can send it to the server using the XMLHttpRequest object instead of a form submission.

Sign up to request clarification or add additional context in comments.

2 Comments

I have a service that accepts imageData of type "java.nio.ByteBuffer". Can I convert this "encoded data as text" to "java.nio.ByteBuffer".
I have no idea what that means (at least in so far as it relates to HTTP). I would assume that using a JavaScript File object and a FormData object with XHR would do the job.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.