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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:44:33+00:00 2026-06-09T09:44:33+00:00

I am currently working on a website where users can upload files. How can

  • 0

I am currently working on a website where users can upload files. How can I prevent large files to be uploaded? At the time, no option (PHP’s post_max_size and upload_max_filesize) has been useful: the file is uploaded entirely. I would simply like the connection to be closed with too large files (by checking Content-Length HTTP header beforehand, and by checking while the file is being uploaded). Is there an Apache directive, or a PHP configuration key for this?

Thank you for your time!

EDIT: added Apache conf (CentOS default).
EDIT2: added PHP conf (CentOS default) as well.

EDIT3: It seems that PHP closes the pipe when given a too large file. Nevertheless, Apache still allows transfer til it ends.

  • 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-09T09:44:35+00:00Added an answer on June 9, 2026 at 9:44 am

    Ok.

    So the main problem you are facing is that Apache directive LimitRequestBody or LimitXMLRequestBody are applied after the completion of the upload. Seems like apache is waiting for a complete file in a temporary folder before checking is size.

    So you need to cut-down the connection right after the detection of too big uploads. One upon a time mod_throttle was a module available to do that. Checking this Alternative to mod_throttle servfault question you can have a list of bandwith control modules that may fit your needs.

    mod_bwshare for example is able to limit bandwith per client IP, but that’s not a per-request per_IP limit. There is also mod_quos, handling a lot of limitations on download things, but I can’t find a lot of things for upload managment (only closing early slow upload maybe). See also this answer on throttling uploads.

    So you may also check for OS level limitation (on the TCP stack) or advanced firewall capabilities (ask on servfault).

    You can also use client side limitation tools, like hidden form values or js uploader settings, but like anything used client-side, in term of security you cannot avoid someone altering the client-side limitations.

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

Sidebar

Related Questions

I am currently working on a website that users can download binary media files
I’m currently working on a website that will enable users to upload certain types
I'm working on a website that has articles on which currently users can comment
I'm currently working on a website which is displaying users tweets from the twitter
I'm currently working on a website in PHP, and I'm wondering what the best
I am currently working on a building community website in PHP. This contains forms
I am currently working on integrating a PHP/MySQL-based e-commerce website I manage with the
Part of a website I am currently working on contains registration process where users
I am currently working on a website that needs to upload the images of
I'm currently working on a website for a photographer, every photo is tagged with

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.