question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: 'slice' called on an object that does not implement interface Blob.

See original GitHub issue

I am previewing the image on page, and after clicking on save button I am uploading image + sending http data of other form fields.

The image gets uploaded successfully but when sending http request to save all data, the error occurs. “Error: ‘slice’ called on an object that does not implement interface Blob.” Tried a lot to solve this not got success.

Please help me on this.

Upload code:

            Upload.upload({
                url: 'myproject/controller/image_upload',                
                file: file,
                method: 'POST',
                sendFieldsAs: 'form'
            }).progress(function (evt) {
                var progressPercentage = parseInt(100.0 * evt.loaded / evt.total);
                console.log('progress: ' + progressPercentage + '% ' + evt.config.file.name);
            }).success(function (data, status, headers, config) {
                console.log('file ' + config.file.name + 'uploaded. Response: ' + data);
            }).error(function (data, status, headers, config) {
                console.log('error status: ' + status);
            }) 

Code to save form data

            $http({
                method: 'POST',
                url: "myproject/controller/get_data",
                data: $.param($scope.store),
                headers: {'Content-Type': 'application/x-www-form-urlencoded'}
            })

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
udaybajarecommented, Feb 3, 2019

Did you get a solution for this problem? I am facing the same problem while sending Input type=“file” value using Ajax. Your help is appriciated.

0reactions
DanroyNdungucommented, Jan 29, 2022

Found that you should just add “contentType: false, processData: false,” to your ajax request. Look at this https://stackoverflow.com/questions/19722920/submitting-a-file-with-jquery-ajax-gives-typeerror

Read more comments on GitHub >

github_iconTop Results From Across the Web

Submitting a file with jQuery.ajax gives TypeError
This results in the error TypeError: 'append' called on an object that does not implement interface FormData . What causes this error? It...
Read more >
File input Blob.slice error
I create a simple object that contains all the inputs in key/value pairs - shown as the last log entry. I'm guessing this...
Read more >
TypeError: 'append' called on an object that does not ...
TypeError : 'append' called on an object that does not implement interface FormData. var name=$('#element_name'). val(); var ofile=document. ...
Read more >
'append' called on an object that does not implement interface ...
I m getting the below error while executting the ajax call with FormData in above code. TypeError: 'append' called on an object that...
Read more >
TypeError: stepUp called on an object that does not ... - YouTube
jQuery : TypeError: stepUp called on an object that does not implement interface HTMLInputElement [ Beautify Your Computer ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found