Skip to content

Instantly share code, notes, and snippets.

@rnjailamba
Last active May 2, 2018 23:33
Show Gist options
  • Save rnjailamba/51bd1fb81c5627ecdd13 to your computer and use it in GitHub Desktop.
Save rnjailamba/51bd1fb81c5627ecdd13 to your computer and use it in GitHub Desktop.
Keystone js + PDF upload to AWS
In your model simply add a field for the pdf -
Admission.add({
name: { type: String, required: true },
state: { type: Types.Select, options: 'draft, published, archived', default: 'published', index: true },
author: { type: Types.Relationship, ref: 'User', index: true },
publishedDate: { type: Types.Date, index: true },
pdf: { type: Types.S3File },
content: {
brief: { type: Types.Html, wysiwyg: true, height: 150 },
extended: { type: Types.Html, wysiwyg: true, height: 400 },
}
});
After this you need to change keystone.js with the details you get
after setting up AWS and creating a bucket and generating a key and secret-
keystone.set('s3 config', {
bucket: 'xy',
key: 'xyz',
secret: 'xyz'
});
And it works !!!!!!
@hari419
Copy link

hari419 commented Nov 8, 2017

sorry its not working
i'm getting this below error, don't know why!!!
upload failed - Amazon returned Http Code: 400

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment