I'm new to web development and server requests, I have a url to an amazon s3 bucket and I have all the required values, such as key, policy, security token, signature, and the file I want to upload etc. I was wondering how I would actually upload the file to the s3 bucket in javascript. Would I use: $.post, or something else and what would the parameters be for the request and the format. Currently I keep getting error 412 or 403. Thanks
I would suggest using the AWS Javascript SDK which is a library of functions for interacting with AWS service endpoints. If you attempt to post directly to a service endpoint or s3 URL then you will be expected to have signed the call using the standard AWS Signature v4 which can be hard to implement and is done for you in the SDK libraries.
The SDK will also correctly integrate with IAM permissions which you typically need to have correctly setup to write to a bucket.
A full example is provided here