Reputation: 2937
I am using amazon's AWS PHP SDK (https://github.com/aws/aws-sdk-php) to generate a set of form inputs using PostObjectV4
. These form inputs will be passed with my post request in order to allow a user to upload a file to a specified bucket for a given amount of time.
The following post describes what I am doing: https://cwhite.me/avoiding-the-burden-of-file-uploads/.
I was also hoping to limit the number of files that this user can upload to the bucket using the generated inputs. In other words, the user would have to request a new set of inputs for each file uploaded. Right now it seems like I can only limit access for a certain period of time, but not how many files get uploaded.
Keep in mind that the form submission is being sent directly to amazon so this would have to be done through a AWS policy or an option passed to the PostObjectV4
object. I did not find anyone with a similar issue online. Any help would be greatly appreciated.
Upvotes: 1
Views: 163
Reputation: 269500
Your research is correct. The policy on the form can restrict the time during which the object can be uploaded (as well as size, filename, etc) but it cannot restrict the quantity of files uploaded.
One option is to specify the exact key
of the object and have the policy enforce that specific key, which will force each subsequent upload to overwrite the previous object.
Upvotes: 1