 angular.module('cg.fileupload')
-.factory 'cgFileUploadCtrl', ($timeout, $q) ->
+.factory 'cgFileUploadCtrl', ($timeout, $q, $http) ->
 
     class cgFileUploadCtrl
 


            return defer.promise

        _uploadWorker: ({ file, filename, uploadUrl, uploadMethod }) ->
            defer = $q.defer()
            script = document.querySelectorAll('[src*="cg-file-upload.js"]')[0]
            workerUrl = new URL script.src.replace 'file-upload.js', 'file-upload-worker.js'

            _ctrl =
                filename: _filename
                originalFilename: _originalFilename
                file: file
                signedUrl: false
                setDestFolder: (destFolder) -> _ctrl.destFolder = destFolder
                setFileName: (filename) -> _ctrl.filename = filename
                setUploadUrl: (uploadUrl) -> _ctrl.uploadUrl = uploadUrl
                setUploadMethod: (uploadMethod) -> _ctrl.uploadMethod = uploadMethod
                isSignedUrl: (signedUrl) -> _ctrl.signedUrl = signedUrl

            _doUpload = =>
                @_upload(
