Skip to content

File upload - No 'Access-Control-Allow-Origin'  #547

Closed
@cyboolo

Description

@cyboolo

Hi

Could you help me to implement file upload with parse server on client side and on server side.

I have this error when I try to upload:

XMLHttpRequest cannot load https://evening-plateau-93592.herokuapp.com/parse/files/avatar.png. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://cyboolo.worldsecuresystems.com' is therefore not allowed access.

I have updated middleware.js with last commit but still the same problem.

Before migration to parse server, on client side, I used:

`myDropzone.on("addedfile", function(myfile) {

if(myfile && (myfile.size<3000000)){

    var name = "avatar.png";
    var parseFile = new Parse.File(name,myfile);

    parseFile.save().then(function(){

    Parse.Cloud.run("modify_avatar", {A:parseFile},{
                success: function(reponse){

                //on cloud code I attached the file path to User class.    

                },
                error: function(error){ console.log(error); }
            });


        }, function(error){});
    ////
    }    

});`

That worked perfectly but now with parse server I do not know how to make it work.

I have my db on mongodb and deployed parse server on heroku. Everything is working fine except this file upload that I can't manage.

Thank you for your help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions