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

Google Cloud Storage file upload fails on ios device #106

Closed
torayeff opened this issue May 24, 2015 · 2 comments
Closed

Google Cloud Storage file upload fails on ios device #106

torayeff opened this issue May 24, 2015 · 2 comments

Comments

@torayeff
Copy link

Uploading to Google Cloud Storage from iOS device gives this error:

Error: Failed to upload file to cloud storage [ - 0]
{"error":" - 0","reason":"Failed to upload file to cloud storage","message":"Failed to upload file to cloud storage [ - 0]","errorType":"Meteor.Error"}

It works, on android simulator, ios simulator and android device but not in ios device. This is my code:

'click [data-action=browse-gallery]': function() {
        var options = {  
            width: 256,
            height: 256,
            quality: 75,
            sourceType: Camera.PictureSourceType.PHOTOLIBRARY
        };

        MeteoricCamera.getPicture(options, function(err, dataURI){
            if (err) {
                alert(err);
            } else {
                $('.avatar-actions').hide();
                $('.avatar-options').show();
                Session.set('test-img', dataURI);
            }
        });
    },

    'click [data-action=upload-avatar]': function() {
        var avatarUploader = new Slingshot.Upload('avatarUploader');
        var img = dataURItoBlob(Session.get('test-img'));

        $("#upload-btn").hide();
        $(".loading").show();

        avatarUploader.send(img, function(err, url) {
            if (err) {
                console.log(err);
                alert(err);
            } else {
                Meteor.call('changeAvatar', url);
                Router.go('account');
            }
        });
    },
@gsuess gsuess changed the title Meteor Slingshot file upload fails on ios device Google Cloud Storage file upload fails on ios device May 25, 2015
@gsuess
Copy link
Contributor

gsuess commented May 25, 2015

While I cannot test things on iOS, I can only suggest that you try Slingshot.GoogleCloudResumable that you can find on this branch.

It is an old branch, which was never released because there is a bug in google-cloud CORS mechanism, meaning that it will not work in a browser. But do I imagine that this would not be a problem in cordova.

@torayeff
Copy link
Author

@gsuess Yes it was definitely CORS problem, this CORS.json works for me:

[
  {
    "origin": ["*"],
    "responseHeader": ["*"], //note here
    "method": ["GET", "POST", "PUT", "HEAD"],
    "maxAgeSeconds": 3000
  }
]

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

2 participants