jhuckaby / webcamjs

HTML5 Webcam Image Capture Library with Flash Fallback
MIT License
2.5k stars 1.11k forks source link

Ability to change the name of the uploaded file object within the options. #187

Closed JustinGillespie closed 8 years ago

JustinGillespie commented 8 years ago

Currently, there does not seem to be a way to change the uploaded file object name.

(php example) when files are sent to the server, they are bundled under the name 'webcam': $FILES['webcam']

I am integrating this into a pre-existing application that also handles uploading an image. All of our files are being uploaded via a $FILES{'photo'] namespace, compressed, resized, etc...

Webcamjs works perfectly within this system, but we have to write extra code to handle the fact that we can't change the uploaded object name to $FILES['photo'] so it handles everything appropriately.

This seems like an easy fix that could use the name 'webcam' as the default, but allow the developer to update that name within the options object.

jhuckaby commented 8 years ago

Certainly, I'd be happy to make this configurable. It'll be in the next release, hopefully this weekend if I can find some time.

JustinGillespie commented 8 years ago

That would be fantastic. Thank you for all your hard work on this project.

jhuckaby commented 8 years ago

You're welcome!

So as it turns out, this feature is already implemented (it's not documented yet tho). Just set the upload_name parameter to whatever you want (it defaults to webcam). Example:

Webcam.set( 'upload_name', 'photo' );

I'll add this to the official documentation in the next release.

Thanks!

eddie24 commented 8 years ago

quiero saber como guardar mis imagenes tomadas en la camara en base 64 en la bd en un campo blob ayuda no soy muy habil