Interceptor for PostAddFile get empty file property
Hi,
I would like to intercept the upload of a file to the Media section. When the file is an video file, I would like to change the url so it is posting to a custom controller. I made the simple interceptor below:
angular.module('umbraco.services').config([
'$httpProvider',
function ($httpProvider) {
$httpProvider.interceptors.push(['$q', '$injector', 'notificationsService', function ($q, $injector, notificationsService) {
return {
'request': function (request) {
if (request.url.indexOf("/umbraco/backoffice/UmbracoApi/Media/PostAddFile") === 0) {
if (request.file.name.endsWidth(".mp4")) {
request.url = "/umbraco/api/Video/PostAddFile";
}
}
return request || $q.when(request);
}
};
}]);
}]);
This fails because of the problem that the "file" property is added to the interception but is has a empty value. The other non-file properties have the posted values.
This is the value config of the post request via $http:
This is the value of the config when intercepted
Is there someone who has experiences with intercepting an file-upload request?
Interceptor for PostAddFile get empty file property
Hi,
I would like to intercept the upload of a file to the Media section. When the file is an video file, I would like to change the url so it is posting to a custom controller. I made the simple interceptor below:
This fails because of the problem that the "file" property is added to the interception but is has a empty value. The other non-file properties have the posted values.
This is the value config of the post request via $http:
This is the value of the config when intercepted
Is there someone who has experiences with intercepting an file-upload request?
Best regard, iNETZO
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.