Search Posts

Category: multer

I need to upload a file to server using angularJS, NodeJS and ExpresJS

I tried following this link but got error Node version is 4.4.7 modulerr error in ngFileUpload In controller I have var CIController = angular.module(‘CIController’, [‘ngMaterial’, ‘ngAnimate’, ‘ngAria’, ‘ngMessages’, ‘Alertify’, ‘ngFileUpload’]) .controller(‘childController’, [‘$scope’, ‘$location’, ‘$q’, ‘$timeout’, ‘$log’, ‘CIFactory’, ‘ClientConfig’, ‘Alertify’, ‘Upload’, ‘$window’, function($scope, $location, $q, $timeout, $log, CIFactory, ClientConfig, Alertify, Upload, $window) { // … } Source: AngularJS

How to post data(excel file) through form data in node js application through multer and save file in the application

I am trying to upload an excel file through multer in node js and then save it in the application but I am not able to save it in application data is coming in req.body but it is not saving file into system. I am not able to figure out what I am doing wrong. my angular 4 code : <div class=”center”> <input class=”btnclick” #myInput type=”file” (change)=”handleFileSelect($event)” accept=”.csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/” required /> </div> my service […]

multer "req.file" is undefined for http request from script but working with html form tag

I’ve built a simple file uploader using multer on Node.js. It is working fine when I upload the file with html form tag like this : <form id=”uploadForm” enctype=”multipart/form-data” method=”post”> <input type=”file” name=”userFile” /> <input type=”submit” value=”Upload File” name=”submit”> </form> But if I try to do the same from the javaScript using Angular JS $http request , it throws an error saying “req.file is undefined”. It throws the same error on uploading using postman. My […]

Multer – Node JS – Upload image AND data

Im trying to upload an image to my server using Node JS, Multer and Angular JS. The problem Im facing is no matter what I do, the “req.body” is always empty on server side. I need to send the image along with some information ( a password for instance ) but everything gets undefined when it reaches the server. The image is correctly getting uploaded nevertheless. Can someone advise how to send BOTH some data […]

nodemailer & multer with attachment does not have callback on success

I followed the outline here to get multer setup: to send an attachment with form. And then I checked others resources such as this: for how to get a callback using multer, but with no luck. I do not see any official documentation about sending a success callback back to the client side. I am using angular for the front end. The form emails fine including the attachment, but i’d like to know when […]

how to save image to folder and save imagePaths to database in MEAN stack using Multer

I have a image collection of following schema: { “productId”: {type: String}, “imagePaths”: {type: Array} } I want to upload multiple images and store corresponding image-paths to database. I searched, and came to know that Multer can perform this action, but I am unable to upload and save image-paths for multiple images. I tried with this Angular code, scope.demoMethod = function(){ console.log(‘Method fired.’); var product = $scope.product; $‘/demo/upload’, $scope.product) .then(function (res) { console.log(‘Form Data ::’ […]