So let's say I want to upload a photo to Instagram on iOS using the Alamofire framework to upload it to my server.
Alamofire.upload(
.POST,
"http://sample.com/api/upload",
multipartFormData: { multipartFormData in
multipartFormData.appendBodyPart(data: imageData,
name: "yourParamName",
fileName: "imageFileName.jpg",
mimeType: "image/jpeg")
Here's the problem: how does the "imageFileName.jpg"
get converted into an identifier unique enough to find within thousands of users' pictures in Amazon S3?
Here would be db table of what I mean:
ID | USERNAME | PHOTO
_____________________
1 | ROCKY | <AWS S3 PHOTO URL GOES HERE??>
Use username and date/time combo as prefix for s3, creating a unique S3 name. Say for Rocky uploading an image image.jpg today, the s3 url could be
s3://your-bucket/Rocky/Dec23image.jpg