upload image using angularjs in api centric web applications

188 views
Skip to first unread message

raja bhaskar

unread,
Jun 12, 2014, 2:32:10 AM6/12/14
to ang...@googlegroups.com
I am new at developing API centric web applications with AngularJS. We are going to use AngularJS as frontend framework. We have a upload functionality in the application. I want to upload an image/document using AngularJS and convert the uploaded image into byte code, then send the byte code to the API service. How can we create bytecode using AngularJS? Please guide me if you have any idea.

Stephen Friedrich

unread,
Jun 12, 2014, 4:02:36 AM6/12/14
to ang...@googlegroups.com
Depends on your minimum browser requirements.
It is quite easy to do with HTML 5 File API - see for example
https://egghead.io/lessons/angularjs-file-uploads
and to get nice styling:
http://gregpike.net/demos/bootstrap-file-input/demo.html

For older browsers you are basically out of luck: For that case the server API must be able handle a regular form upload. Also the usual trick to avoid a page reload is to specify an iframe as the target, have the server reply with json content, but html mime type and parse the result from the iframe.
There sure is existing code than you can use for that, too.
Reply all
Reply to author
Forward
0 new messages