I'm curious why this cannot be done?
As the file starts uploading, the upload progress bar indicates percentage of file uploaded, and also has the file size to be uploaded. At the point that the file size is determined, why can't the upload be immediately aborted with an oversize error? I've read the issue queues, and see that this is not supposedly possible, but not really sure why. This is a great module, but would like to keep someone from starting the upload of say, a 6meg file only to have it fail. Or even someone trying to send a hellaciously large file. It will fail, but will chew up a lot of bandwidth and processor/memory time.

I've a screencrop attached.

Thank you much. :)
- johnc

CommentFileSizeAuthor
image-upload-exceeds-allowed.png3.15 KBjcchapster
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

quicksketch’s picture

Category: support » feature
Status: Active » Closed (won't fix)

These are very good observations and I believe could definitely be accomplished via JavaScript. Unfortunately most users don't have the PECL uploadprogress at their disposal so we're already talking about a 10% use-case here. Technically speaking, I'm also not sure how we could interrupt one AJAX request after the progress bar starts. The progress bar works by repeatedly pinging the server in separate AJAX requests for progress updates, while the main AJAX request uploads the file into an iFrame. I'm not sure if it's actually possible to interrupt this other request though.

I think it's probably actually possible, but because FileField has been moved into core and I think this already is a slightly edgy scenario, I'm not going to spend any time on it. I'd suggest trying to make this improvement to Drupal core, but we probably won't ever see it in Drupal 6. Please reopen if providing patches, I'd still be happy to have a look.