C
C
Cyber_bober2017-04-21 21:47:04
Angular
Cyber_bober, 2017-04-21 21:47:04

How to make angularjs and multer friends without angular-file-upload?

Hello, how to transfer a file from angular without using third-party directives?
1. There is a form with text fields and a field with an image, I process the image like this, I display the result in base64 in the preview, and I want to transfer the file itself to multer - $scope.order.image

fileReader.readAsDataUrl($scope.file, $scope)
            .then(function(result) {
                $scope.order.image = $scope.file;
                $scope.order.image_preview = result;
            });

What is the best way to do this? load the file separately on onChange, get the generated file name from multer and pass it to the database as a separate request when submitting the form? Maybe someone has some solutions how to make them friends without using additional libraries from npm ?!
Thank you.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question