Javascript 在AngularJs中将图像从文件系统发送到服务器

Javascript 在AngularJs中将图像从文件系统发送到服务器,javascript,angularjs,file-upload,ionic-framework,Javascript,Angularjs,File Upload,Ionic Framework,我需要在后台发送多个图像和一些数据到服务器 我在android应用程序中使用ionicframework和angularjs。 我正在使用angular文件上载,以下代码是我的工厂代码: if(angular.isArray(arrPictures) && arrPictures.length > 0) { var files = []; for(var i=0; i<arrPictures.length; i++) {

我需要在后台发送多个图像和一些数据到服务器

我在android应用程序中使用ionicframework和angularjs。 我正在使用angular文件上载,以下代码是我的工厂代码:

if(angular.isArray(arrPictures) && arrPictures.length > 0) {

       var files = [];
       for(var i=0; i<arrPictures.length; i++) {
           files.push(arrPictures[i].photo); //it is like file://my_path/myImage.jpg
       }

        $upload.upload({
            url: API_POST_ANSWER,
            method: 'POST',
            data: {
                "idSurvey": idSurvey,
                "idOAM": idOAM,
                "idOPM": idOPM,
                "score": score,
                "date": date,
                "answerJson": answersJson,
                "address": address,
                "latitude": latitude,
                "longitude": longitude
            },
            file: files,
            fileFormDataName: "pictures"
        }).progress(function (evt) {
            //progress
            alert('progress: ' + parseInt(100.0 * evt.loaded / evt.total) + '% file :'+ evt.config.file.name);
        }).success(function (data, status, headers, config) {
            // file is uploaded successfully
            alert('file ' + config.file.name + 'is uploaded successfully. Response: ' + data);
        }).error(function (ex) {
            //error
            alert("error");
            alert(ex);
        });

   } 
现在我有一个问题,因为服务器获取字符串路径字符串而不是文件
我的问题是如何将路径字符串转换为文件对象以将其当前发送到服务器?

我的解决方案是将图像转换为base64并使用sqllite将其存储到本地数据库中。 之后,当我想要发送图像时:我查询我的数据库,得到base64字符串并将其发送到我的rest服务


所有这些解决方案都不使用$upload指令,而是使用$http服务。

您使用的是哪台服务器?您是否确保服务器能够正确接收文件?是否有其他解决方案?