[owncloud-devel] Issue with upload images though WebDAV (but it works well for other kind of files like a .docx)

Cedric Carbone cedric.carbone at nanocloud.com
Thu Dec 10 23:24:34 GMT 2015


Hi guys,

I use a PUT request through WebDAV to upload file into owncloud server.
It works well except for images files (png, jpg…) The upload doesn’t throw any error but I cannot download the image file afterward (while it works well for other kind of files like a Word document).
If I use the owncloud web based client, I can see the size of the uploaded image file is not the same as when I use my code (that do a PUT request through WebDAV).

Do you have any idea where I can find to fix my bug? I can for sure give you more detailed if needed. My code is bellow if this can help to understand my issue.

Thanks a lot for your guidance,

-cedric





$rootScope.uploadFiles = function (files) {

        $location.hash('bottom');

        $anchorScroll();

        console.log(files[0]);

        $rootScope.uploadingFile = files[0];

        $rootScope.uploadingFile.mtime = new Date();

        $rootScope.uploadingFile.percent = 0;

        console.log($rootScope.currentDir.path);

        angular.forEach(files, function (file) {

            //blockUI.start();

            Upload.upload({

                url:  $window.serverPath + 'owncloud/remote.php/webdav/' + $rootScope.currentDir.path + '/' + file.name,

                file: file,

                method: 'PUT'

            }).then(function (resp) {

                $rootScope.currentDir.treeData = [];

                $rootScope.currentDir.listFiles = [];

                //blockUI.stop();

                $rootScope.fetchAllPlace($rootScope.currentDir);

                console.log(resp);

                $rootScope.uploadingFile = null;

                EventService.create({

                    type: 'upload',

                    postedTime: (new Date()).getTime(),

                    content: $rootScope.currentUser.displayName + ' added ' + '<span class="event-file">' + file.name + '</span>',

                    fromUser: $rootScope.currentUser,

                    path: $rootScope.currentDir.path

                });

            }, function (resp) {

                console.log('Error status: ' + resp);

                $rootScope.uploadingFile = null;

            }, function (evt) {

                var progressPercentage = parseInt(100.0 * evt.loaded / evt.total);

                $rootScope.uploadingFile.percent = progressPercentage;

                console.log('progress: ' + progressPercentage + '% ');

            });

        });



    };


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.owncloud.org/pipermail/devel/attachments/20151211/0b1c94fb/attachment.html>


More information about the Devel mailing list