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 9146493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:45:51+00:00 2026-06-17T10:45:51+00:00

I am working on a website that allows people to upload their images. It’s

  • 0

I am working on a website that allows people to upload their images. It’s mainly just a learning experience, and I’m writing it in python. One thing it should be able to do is take a url where an image resides, then reupload that to its own server. So here’s the question:

One person gives my website a url, then my server starts downloading the image. While it is downloading that image, another request comes in. Is there any way to get the server to give a response (Like saying the server is busy) even when it’s doing something else? Is there a better way to go about this?

Thanks in advance!

  • 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-17T10:45:52+00:00Added an answer on June 17, 2026 at 10:45 am

    I wrote up an example that I hope you find helpful. It consists of a urls.txt file that lists the jobs to process and a xdownloader.py file which downloads using multiple processes. I tested it on a Linux machine running Python 2.7.

    xdownloader.py

    from multiprocessing import Process
    import urllib2
    
    def main():
    
      try:
    
        # Read URLs/Destinations from a file
        jobs = []
        with open("urls.txt","r") as ifile:
          for line in ifile:
            jobs.append(line.split(" "))
    
        # Create a process list to keep track of running processes
        process_list = []
        # Iterate through our jobs list
        for url, save_to in jobs:
          # Create a new process that runs function 'download'
          p = Process(target=download, args=(url, save_to))
          # Save it to a list
          process_list.append(p)
          # Start the process
          p.start()
      except KeyboardInterrupt:
        print("Received keyboard interrupt (ctrl+c). Exiting...")
      finally:
        # Wait for all processes to finish before exiting
        for process in process_list:
           # Wait for this process to finish
           process.join()
        print("All processes finished successfully!")
    
    
    def download(url, destination):
      # Open a request
      request = urllib2.urlopen(url)
      # Read and save the webpage data to a file
      with open(destination, "w+") as save_file:
        print("Downloading {0}".format(url))
        save_file.write(request.read())
    
    if __name__=="__main__":
      main()
    

    urls.txt

    http://google.com google.html
    http://yahoo.com yahoo.html
    http://news.google.com news.google.html
    http://reddit.com reddit.html
    http://news.ycombinator.com news.ycombinator.html
    

    Running python xdownloader.py I get:

    mike@localhost ~ $ python xdownloader.py 
    Downloading http://news.ycombinator.com
    Downloading http://reddit.com
    Downloading http://news.google.com
    Downloading http://google.com
    Done downloading http://google.com
    Done downloading http://news.ycombinator.com
    Done downloading http://reddit.com
    Downloading http://yahoo.com
    Done downloading http://news.google.com
    Done downloading http://yahoo.com
    

    You can see that the jobs are running asynchronously… Some jobs start earlier, but finish later than the others. (I’m looking at you news.google.com!) If this example doesn’t fit your needs, please let me know in the comments.

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

Sidebar

Related Questions

I just started working on a website that will help people understand what rappers
I'm working on a website that allows people who run bed and breakfast businesses
I am working on a website that allows people to register for events. On
I'm working on a company website that allows users to have their own homepage
I'm working on a website that allows users to create an account. One of
I'm working on a website that just uses HTML, CSS, and JS (no backend
I'm working on StackQL.net , which is just a simple web site that allows
I am working on a website that allows users to choose a standard car
So I have an ASP.NET MVC 3 website that allows people to advertise certain
I'm working to develop a website that allows clients to log in and see

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.