Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could I post the image as base64 in JSON? #45

Open
tombujok opened this issue Jun 20, 2014 · 1 comment
Open

Could I post the image as base64 in JSON? #45

tombujok opened this issue Jun 20, 2014 · 1 comment

Comments

@tombujok
Copy link

Hi,

Maybe it's a stupid idea buy I am using a groovy server and I wouldn't mind if I could get the image as base64. I don't want to use the upload.php file. Is there a way to bind the base64 string to a ng-model?

Many thanks!
Tom

@PazkaL
Copy link

PazkaL commented Jul 30, 2014

Try something like this:

            $scope.$on('flow::fileAdded', function (event, $flow, flowFile) {
                var reader = new FileReader();
                reader.onload = function(event) {
                    $scope.filedata = event.target.result.substr(event.target.result.indexOf('base64')+7);
                    $scope.filename = flowFile.file.name;
                };
                reader.readAsDataURL(flowFile.file);
            });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants