Closed mcgowanb closed 7 years ago
You're not giving me much code to work with here. Can you do better, elaborate more?
I'm forced to assume:
I'd have to guess and assume and I can't. Knowing this is used in production on my end, I'm not going fishing for you just yet.
Review this code, as this is where the work is done that you are in need of help with: https://github.com/AckerApple/ack-angular-webcam/blob/master/lib/webcam.component.ts#L362
photo.zip Formdata is an empty object that gets returned. I'm using a copy and paste from this example here https://www.npmjs.com/package/ack-angular-webcam#example-usage
Camera works fine, builds and compiles and I can get the base64 of the image no problem. Trying to generate a file for a form to post is the issue
Attached is the component that I've implemented it in
Everything is built and confirmed working in Chrome. Ensure you start there.
I don't think you have an error then if you are getting back an empty FormData as FormData typically looks blank...
Try it in the console of your browser:
Review the last result and your FormData object looks blank when it is not
If all your concern is a blank FormData than I am to conclude you've not much used it before?
You need to use the getAll() command
Looks like you've solved my problem. Thank you. One question - how can i log out the file information. Is it getAll('fileName') or getAll('file.jpg')?
So listen, I'm going to be honest with you and you might laugh at my honesty: I haven't used FormData all that much. lol.
I mean yeah I have but always to the point that it works and then I move on. I found it so bizarre that you cant see its information but I think because its a file system component, maybe?
You gotta search the docs how to work with it. I love giving free code, free info just isn't the same.
Be well
Using the example provided below from the main page
//get HTML5 FormData object and pretend to post to server genPostData(){ this.webcam.captureAsFormData({fileName:'file.jpg'}) .then( formData=>this.postFormData(formData) ) .catch( e=>console.error(e) ) }
once the promise is returned, the formdata is null. I've looked and can't find why its returning null. Is something missing?