无法使用角度js发布视频文件

时间:2017-08-01 09:47:16

标签: angularjs

我收到success = true,但我的文件路径错误。我正在捕获视频,然后将该视频的位置路径移交给我的帖子,以便在服务器上传视频。在POSTMAN请求中,它正在提交视频,并在success = true内回复path: app/uploads/jobs/12_524.mp4,但在应用中我只是获得了没有.mp4扩展名的路径

这是电话

$rootScope.uploadQuestion = function (file) {
           //file is complete path of file in device  = localURL: "cdvfile://localhost/sdcard/DCIM/Camera/20170801_142942.mp4"
            var form = new FormData();
            form.append("job_id", "4124");
            form.append("question_id", "11");
            form.append("user_id", "159931");
            form.append("file", file);
            console.log('File: ' + file);
// prints this: File: cdvfile://localhost/sdcard/DCIM/Camera/20170801_142942.mp4
            return $http({
                method: 'POST',
                headers: { 'Content-Type': undefined },
                url: 'http://services.someservice.com/upload.php',
                //transformRequest: angular.identity,
                cache: false,
                timeout: 300000
            }).then(function (response) {
                var data = response.data;
                var status = response.status;
                if (status == '200') {
                    if (data.success == "true") {
                        alert('uploading...');
                    }
                }
            }).catch(function (response) {

                throw response;
            });

        }

0 个答案:

没有答案