jalik / meteor-jalik-ufs

Upload File System for Meteor **DISCONTINUED**
MIT License
100 stars 29 forks source link

Why is upload aborting from cordova? #80

Open JulianKingman opened 7 years ago

JulianKingman commented 7 years ago

I have a cordova app that I'm testing locally (I'm about to test on the dev environment, too), and it aborts instead of completing. I'm not quite sure why... here's my relevant code:

MeteorCamera.getPicture({width: 1024}, function (err, dataURL) {
            const file = dataURItoBlob(dataURL);
            file.name = 'Uploaded File';
            const photo = _.pick(file, 'name', 'type', 'size');

            console.log('file', file, file instanceof Blob);
var upload = new UploadFS.Uploader({
                store: imageStore,
                data: file,
                file: photo,
                adaptive: true,
                onError: function (err) {
                    console.error(err);
                },
                onAbort: function (file) {
                    console.log(file.name + ' upload has been aborted');
                },
                onComplete: function (file) {
                    console.log(file.name + ' has been uploaded');
                    sendMessage(Session.get('otherId'), event, file._id);
                },
                onCreate: function (file) {
                    console.log(file.name + ' has been created with ID ' + file._id);
                },
                onProgress: function (file, progress) {
                    console.log(file.name + ' ' + (progress*100) + '% uploaded');
                },
                onStart: function (file) {
                    console.log(file.name + ' started');
                },
                onStop: function (file) {
                    console.log(file.name + ' stopped');
                }
            });

            upload.start();
        });

I tried lowering the chunk size to 8kb and increasing the number of retries, but neither worked. It works in the browser, and I'm using the --mobile-server 10.0.0.30:3000 flag, where 10.0.0.30 is the IP of my computer.

Any ideas?

ddspog commented 7 years ago

I'm getting the same problem. With a similar code, my log is like this: image

ddspog commented 7 years ago

The error doesn't show up, it only say that the upload was aborted, doing something on the app, or without doing anything.

ddspog commented 7 years ago

Can it be related to #120 ?

JulianKingman commented 7 years ago

I ended up not using this at all and just using cloudinary.

jalik commented 7 years ago

@ddspog Debugging on mobile devices is a pain.. I am sorry I currently don't have the time to dig this issue.. :(

airstep commented 6 years ago

+1 for this issue... and why you didn't pass reason of error in this line to know what problem is...

In my case error was bcz I didn't specify port number in URL, but onAbort was quite about such err