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

The Archive Base Latest Questions

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

I am using the Tomahawk inputFileUpload component to allow users to upload files to

  • 0

I am using the Tomahawk inputFileUpload component to allow users to upload files to a server. I have implemented a “soft” file size limit by checking the size of the file after it has been uploaded and displaying an error if it is too large. However I would also like a larger “hard” limit, where uploading immediately stops once it has passed the limit. For example if the hard limit is 500MB and the user attempts to upload a 2GB file, uploading will immediately stop once 500MB has been uploaded and an error is displayed.

I had hoped that using the MyFaces ExtensionsFilter and setting uploadMaxFileSize would fix the problem, but the file is completely uploaded before the SizeLimitExceededException is thrown.

Is it possible to do this? Ideally I’d still be able to use Tomahawk but any other solution would be good.

  • 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-03T09:43:16+00:00Added an answer on June 3, 2026 at 9:43 am

    The web server can’t abort a HTTP request halfway and then return a HTTP response. The entire HTTP request has to be consumed fully until the last bit before a HTTP response can ever be returned. That’s the nature of HTTP and TCP/IP. There’s nothing you can do against it with a server side programming language.

    Note that the Tomahawk file upload size limit already takes care that the server’s memory/disk space won’t be polluted with the entire uploaded file whenever the size limit has been hit.

    Your best bet is to validate the file length in JavaScript before the upload takes place. This is supported in browsers supporting HTML5 File API. The current versions of Firefox, Chrome, Safari, Opera and Android support it. IE9 doesn’t support it yet, it’ll be in the future IE10.

    <t:inputFileUpload ... onchange="checkFileSize(this)" />
    

    with something like this

    function checkFileSize(inputFile) {
        var max = 500 * 1024 * 1024; // 500MB
    
        if (inputFile.files && inputFile.files[0].size > max) {
            alert("File too large."); // Do your thing to handle the error.
            inputFile.value = null; // Clears the field.
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know how to do file upload using Primefaces or using Tomahawk, however, I
I am currently ussing Tomahawk MyFaces to upload files in to my server. I
I'm using Tomahawk library for the file upload. However, the backing bean's method is
using (var file_stream = File.Create(users.xml)) { var serializer = new XmlSerializer(typeof(PasswordManager)); serializer.Serialize(file_stream, this); file_stream.Close();
I'm using tomahawk's datascroller to page though data in a datatable. I have two
Actually I'm creating an application for uploading file using JSF. But whenever I upload
I'm using MyFaces 1.1.7 with Facelets and Tomahawk. When creating a regular data table,
Using C# for ASP.NET and MOSS development, we often have to embed JavaScript into
I am using JSF 1.2 without tomahawk and other libraries. The JSF Applicatin works
I am using JSF Myfaces Impl 1.2 without tomahawk and other libs : I

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.