Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7877447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:22:26+00:00 2026-06-03T03:22:26+00:00

According to Secure User Image Upload Capabilities in PHP , the recommended way is

  • 0

According to Secure User Image Upload Capabilities in PHP, the recommended way is to manage images uploading’s security is to copy the incoming image with GD/ImageMagick/… (and set it with a random name).

Ok. I have the following questions.

1st.

In our page we have the possibility of cropping the image. So:

  • First we download the image uploaded by the user, saving it in temp with a random name.
  • Then we load it in our view so user can crop it.
  • The image cropped is created with GD.

Is it risky to load the image without having processed with GD first?

2nd

Is process the image with GD enough? I’ve seen this answer: Block upload of executable images (PHP)
which says is not (in opposite to the first link and other answers I’ve seen on topic).

Thanks!

PS: Programming with Codeigniter.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T03:22:28+00:00Added an answer on June 3, 2026 at 3:22 am

    1st:

    That should be good enough. Make sure that the images are only temporarily accessible and are deleted right after everything is done (I would probably also set up a cron job to clean the temporary image directory every so often, but that depends where you store it). As said in the answer you posted, remember to sanitize name and also make sure you have correctly set permissions. Also beware of null byte injection and directory traversal (again just repeating the answer you mentioned).
    I would then check whether the image is valid by using getimagesize to ensure it’s an actual image and that’s about it.

    There are also client side html5 solutions, where you evade this problem completely, but of course it means that it won’t work with older browsers.
    And of course don’t trust what the content type it says it is.

    2nd:
    Yes I would have thought, first try getimagesize, if you get valid then process with GD. Optionally you can also whitelist extensions, if that’s something you are not doing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I didnt find anything according this issue. Can jaas be used to secure my
according to this description I just created an nine-patch image. I named it androidRow.9.png
According to C++03 Standard (23.1/3) only copy-constructible class objects can be stored in STL
I have set the ActiveDirectoryMembershipProvider connectionProtection attribute to secure, according to MSDN documentation states
According to the PHP manual , in order to make code more portable, they
Can I use Spring Security annotations in my ZKGrails composers to secure the ajax-callbacks,
In my JEE6-CDI-webapp, i declared a Security Interceptor, like this one: //Secure.java @Inherited @Target({TYPE,
According to this question Raphael - event when mouse near element i create a
According to the documentation: public static <T> int binarySearch(T[] a, T key, Comparator<? super
According to a book I have (Eclipse for Minor Geniuses or something like that),

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.