Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

481
Views
Image upload to AWS s3 :Allow only jpg and png images

I am trying to upload only certain type of images into aws s3 bucket. For that i've added the following rule to my bucket policy

"Resource": [
                "arn:aws:s3:::<bucket name>/*.jpg",
                "arn:aws:s3:::<bucket name>/*.png",
            ]

This works fine ,however when i change extension of text file to png (eg: change sample.txt to sample.png) and try to upload its uploaded.

How can i prevent this??.

One solution i've founded is add a php image validation in my code and upload to AWS s3 ,but here i am using s3 direct browser upload in this method there is no need of normal way of php file upload also reduces the server overload. So i think adding php image validation on s3 direct browser upload is bad practise.

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!