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

  • Home
  • SEARCH
  • 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 7933165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:14:43+00:00 2026-06-03T21:14:43+00:00

PHP: Any ideas where I could find a script similar to what stackoverflow uses?

  • 0

PHP:

Any ideas where I could find a script similar to what stackoverflow uses? Or would it be easy to make something like that myself? I’m sure downloading the image is not a problem, but I’m more worried about security. I’m building an user avatar upload/remote upload system.

Jquery:

The reason I added jquery to the tags, perhaps it is possible to let the user point the URL of the image and somehow upload it via the normal file upload input himself (without having to manually download the image to the computer first)

  • 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-03T21:14:45+00:00Added an answer on June 3, 2026 at 9:14 pm

    You can use cURL to download the image and then use getimagesize() to check whether it’s actually an image – for security purposes.

    <?php
    $limit = 1024*1024*10 // Max. file size in bytes (1024*1024*10 = 10MB)
    $ch = curl_init();
    
    $fh = fopen('image.jpg', 'w'); 
    
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_FILE, $fh);
    curl_setopt($ch, CURLOPT_RANGE, '0-' . $limit);
    
    curl_exec($ch);
    
    curl_close($ch);
    
    if ($image = getimagesize ("image.jpg")) { 
         // It's an image
    }
    else { 
         // Not an image; delete!
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I can't find any PHP script to compute Krippendorff's Alpha . I need this
Is there any php libraries or API's that help when dealing with X12 documents
Is there any PHP script to convert XML file to DTD. I tried a
I just want to ask if there is any PHP/MySQL datatype that can store
Possible Duplicate: PHP: Script for generating Crossword game? Does anyone know any PHP-based simple
I am working on a PHP script that needs to read log files in
My php script uses php simplehtmldom to parse html and get all the links
I have a directory which will look something like this: /test/ | |- index.php
I'm trying to implement some kind of caching in a PHP script that will
Any idea in PHP how to get a unix timestamp of the next occurring

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.