Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

Unable to upload a PDF document to File Type #575

Open
gopidon opened this issue May 1, 2019 · 0 comments
Open

Unable to upload a PDF document to File Type #575

gopidon opened this issue May 1, 2019 · 0 comments

Comments

@gopidon
Copy link

gopidon commented May 1, 2019

Hi,

I have been successfully uploading PDF objects to the File Type on my GraphCool project. From today, however, I am getting the following CORS error. It was working fine till yesterday. Did something change on the server side? I am using the legacy GraphCool console project.

Error:
[Error] Origin http://localhost:3000 is not allowed by Access-Control-Allow-Origin.
[Error] XMLHttpRequest cannot load https://api.graph.cool/file/v1/ due to access control checks.
[Log] UPLOAD ERRRRRR: – Object (bundle.js, line 140955)
Object
[Error] Failed to load resource: Origin http://localhost:3000 is not allowed by Access-Control-Allow-Origin. (cizao5xe14rfp0166d827jbmn, line 0)

Code:
_uploadFile(e){
e.preventDefault();
var self = this;
const {id} = this.props.circular;
var fd = new FormData();
var file = document.getElementById(‘file’).files[0];
fd.append(‘data’, file)
var fileName = file.name;
$.ajax({
url: Environment.GCOOL_FILE_ENDPOINT,
data: fd,
type: ‘POST’,
// THIS MUST BE DONE FOR FILE UPLOADING
contentType: false,
processData: false,
// … Other options like success and etc
success: function(data){
console.log(“UPLOAD SUCCESS:”, data);
})

	},
	error: function(data){
		console.log("UPLOAD ERRRRRR:",data)
	}
});

}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant