Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload to azure blob crash on large files #376

Open
SanaaAfifi opened this issue Feb 15, 2022 · 0 comments
Open

Upload to azure blob crash on large files #376

SanaaAfifi opened this issue Feb 15, 2022 · 0 comments

Comments

@SanaaAfifi
Copy link

SanaaAfifi commented Feb 15, 2022

Hello
I want to upload a file using chunks to azure blob storage , the multiple c hunks crash and the upload is not compeleted any help


submitFlow: function () { 
				$scope.blockIds = [];
				$scope.fileTargetUrl =	MyoFileUpload.getUploadFileURL($scope.fileManager.getFlowFile())
				$scope.flowObj.flow.upload();
			}, 

preprocess: function (chunk) {
			
				const value = create_UUID();
				const blockId = btoa(value);
				$scope.blockIds.push(blockId);
				chunk.flowObj.opts.target =
				$scope.fileTargetUrl  +
				  `&comp=block&blockid=${blockId}`;
				  var flowFile = chunk.fileObj;
				  var originalpxr = chunk.prepareXhrRequest;
				  chunk.prepareXhrRequest = function (method, isTest, paramsMethod, blob) {
					  var data = originalpxr.apply(this, arguments);
					  data = this.fileObj.file;
					  this.flowObj.opts.query = {};
					  return data;}
				chunk.preprocessFinished();
			  },
uploadCompleted :function()
			  { 
                          if($scope.fileManager.isCompleted)
				{  
                                    MyoFileUpload.commitChunksList($scope.blockIds,$scope.fileTargetUrl );
				}
			  },

commitChunksList(blockIds, url)
        { 
            var uri = url + '&comp=blocklist';
            console.log(uri);
            var requestBody = '<?xml version="1.0" encoding="utf-8"?><BlockList>';
            for (var i = 0; i < blockIds.length; i++) {
                requestBody += '<Latest>' + blockIds[i] + '</Latest>';
            }
            requestBody += '</BlockList>';
            console.log(requestBody);
            $.ajax({
                url: uri,
                type: "PUT",
                data: requestBody,
              
                success: function (data, status) {
                    console.log(data);
                    console.log(status);
                },
                error: function (xhr, desc, err) {
                    console.log(desc);
                    console.log(err);
                }
            });
 
        },
 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant