【发布时间】:2016-08-15 23:06:21
【问题描述】:
我需要将从我的移动设备拍摄的图像上传到我的服务器。我找到了引用的 angular-upload 库。我需要做的是将图像库转换为 64,通过邮寄方式将其发送到我的服务器,因为服务器是我将与她一起工作的地方。另一个,从我的服务器发送并从应用程序运行它。
var server = URL_BASE+'addView/';
var trustAllHosts = true;
var ftOptions = new FileUploadOptions();
ftOptions.fileKey = 'file';
ftOptions.fileName = $scope.imagen.substr($scope.imagen.lastIndexOf('/') + 1);
ftOptions.mimeType = 'image/jpeg';
ftOptions.httpMethod = 'POST';
console.log(ftOptions);
$cordovaFileTransfer.upload(encodeURI(server), $scope.imagen, ftOptions, trustAllHosts)
.then(function(result) {
console.log(result)
}, function(err) {
// Error
console.log(err);
}, function (progress) {
});
【问题讨论】:
-
您既没有提供问题陈述也没有提供问题....那么问题是什么?问题是什么?
-
不仅仅是问题,我需要一些建议,最好的方法。在遵循本教程的那一刻,我的服务器在其他安全蛋糕上运行时遇到问题。我正在尝试将图片作为 $ _FILE 发送,但我喜欢做的是设备上的托管图像将该字符串传递给 base64 并将其发送到服务器。即使我无法将图像转换为 base64。