hasura / js-sdk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Filestore usage

AjaSharma93 opened this issue · comments

The filestore usage doesn't work with the usage given.
The variable declared below doesn't work for me,
var file = input.files[0];
I solved this by declaring the variable as below,
var file = input;
I need clarification on how this works.

@AjaSharma93 Can you paste the entire code sample please? This probably has something to do with the way you've created input.

Also, make sure you use proper formatting when you're putting code in the comment box. Use ` or ```.

I'll post the specific lines of my code I've used in my app for the filestore
var input = document.getElementById('vehicleImageUpload');
var file=input;
if(file.files[0]==null){
alert('Image must be added');
}
var fileId;
hasura.file.upload(file,
(successResponse) => {
fileId = successResponse.file_id;
(errorResponse) => {
//errors handled here
});

@AjaSharma93 Got it. README has been fixed appropriately :)