-
Notifications
You must be signed in to change notification settings - Fork 54
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
Using getFormPostParams #80
Comments
I am not sure what you are trying to do when you get the signature mismatch? This method is there to help with POSTing from a browser directly to S3, but I haven't thought in detail about the best way to make that available to people using the library (though I myself do use it in its current state extensively as is). |
I am using Uppy. It does a direct upload after I get a presigned key.
Supposed to any way.
…On Wed, Jun 14, 2023, 5:53 PM John Berquist ***@***.***> wrote:
I am not sure what you are trying to do when you get the signature
mismatch? This method is there to help with POSTing from a browser directly
to S3, but I haven't thought in detail about the best way to make that
available to people using the library (though I myself do use it in its
current state extensively as is).
—
Reply to this email directly, view it on GitHub
<#80 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAH5HDKU2GVKX6UIPMA3U6TXLIXELANCNFSM6AAAAAAZFIPHF4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Are you trying to do PUT or POST requests? This method is only for using POST. For example: // in CFML
// Whatever form fields you intend to pass with the request go here
var formFields = [
{ name: 'acl', value: 'private' },
{ name: 'success_action_status', value: '201' },
{ name: 'Content-Type', value: 'application/pdf' },
{ name: 'Content-Disposition', value: 'attachment; filename="myfile.pdf"' },
{ name: 'name', value: 'myfile.pdf' }
];
formFields.append(
aws.s3.getFormPostParams(
'my_s3_bucket',
'my_key',
formFields
),
true
);
var formFieldsStruct = formFields.reduce( function( resultStruct, item ) {
resultStruct[ item.name ] = item.value;
return resultStruct;
}, { } );
// use these fields in a struct that could be serialized to JSON and returned to the client
var uploadParameters = {
method: 'POST',
url: 'https://my_s3_bucket.s3.amazonaws.com',
fields: formFieldsStruct,
headers: {}
}; You could then use the uploadParameters in Uppy, it looks like: https://uppy.io/docs/aws-s3 - I haven't used Uppy myself, so this may require some tweaking to get it to work. |
Thanks, I'll check it out.
…On Wed, Jun 14, 2023, 7:18 PM John Berquist ***@***.***> wrote:
Are you trying to do PUT or POST requests? This method is only for using
POST. For example:
// in CFML
// Whatever form fields you intend to pass with the request go herevar formFields = [
{ name: 'acl', value: 'private' },
{ name: 'success_action_status', value: '201' },
{ name: 'Content-Type', value: 'application/pdf' },
{ name: 'Content-Disposition', value: 'attachment; filename="myfile.pdf"' },
{ name: 'name', value: 'myfile.pdf' }
];
formFields.append(
aws.s3.getFormPostParams(
'my_s3_bucket',
'my_key',
formFields
),
true
);
var formFieldsStruct = formFields.reduce( function( resultStruct, item ) {
resultStruct[ item.name ] = item.value;
return resultStruct;
}, { } );
// use these fields in a struct that could be serialized to JSON and returned to the clientvar uploadParameters = {
method: 'POST',
url: 'https://my_s3_bucket.s3.amazonaws.com',
fields: formFieldsStruct,
headers: {}
};
You could then use the uploadParameters in Uppy, it looks like:
https://uppy.io/docs/aws-s3 - I haven't used Uppy myself, so this may
require some tweaking to get it to work.
—
Reply to this email directly, view it on GitHub
<#80 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAH5HDLAVBGHR4OBUROYUSDXLJBDPANCNFSM6AAAAAAZFIPHF4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I know it says TODO, but can you TODO it now? lol.
I am getting a signature mismatch and wondering if it's because I am not using this.
The text was updated successfully, but these errors were encountered: