Quick Links
ASP.NET File Upload Progress - Allowed File Extensions and Sizes
This example demonstrates how to set available extensions and maximum size for uploading files.
Here can be uploaded files with extension
gif
(maximum size
10000 bytes
) and files with extension
txt
of any size.
On submit file
inputs
that contain files with not allowed extensions are cleared and no submit occurs. Client-side function is called after this clearing if
OnClientFileCleared
property of control is set.
Files with size exceeding maximum are
rejected
from HTTP request and server-side does not receive them. Client-side function is called after every such reject if
OnClientFileRejected
property of control is set.
Example code
<
%@ Register
TagPrefix
="fup"
Namespace
="OboutInc.FileUpload"
Assembly
="obout_FileUpload"
%
>
...
<
script
type
="text/JavaScript">
function
Rejected(fileName, size, maxSize){
var
addMessage = (maxSize >= 0)?(
"exceeds "
+maxSize+
" bytes"
):(
"-- session lost"
);
alert(
"File "
+fileName+
" is rejected \nIts size ("
+size+
" bytes)
"
+
addMessage
);
}
function
ClearedFiles(fileNames){
alert(
"Cleared files with bad extensions:\n\n"
+fileNames);
}
</
script
>
...
<
input
type
=file
name
="myFile1"><
br
/>
<
input
type
=file
name
="myFile2"><
br
/>
<
input
type
=file
name
="myFile3"><
br
/>
<
input
type
=submit
value
="submit"
name
="mySubmit"><
br
/>
<
fup:FileUploadProgress
runat
="server"
ShowUploadedFiles
="true"
OnClientProgressStopped
="function(){alert('My custom OnClientProgressStopped event');}"
OnClientFileRejected
="Rejected"
OnClientFileCleared
="ClearedFiles"
>
<
AllowedFileFormats
>
<
fup:Format
Ext
="gif"
MaxByteSize
="10000"
/
>
<
fup:Format
Ext
="txt"
/
>
<
/
AllowedFileFormats
>
<
/
fup:FileUploadProgress
>
See also
Server side properties
,
OnClientFileCleared function
,
OnClientFileRejected function
pages.
Uploaded 
% (
) Total
Uploaded
files
file
from
Uploading file
Last uploaded file
:
Elapsed time:
Estimated time:
Speed:
(Session lost)
rejected
uploaded
"
I am very very impressed, happy, satisfied and grateful. Again you have my sincere thanks!
"
Cary Abramoff
The Bank of New York Mellon
obout.com
obout.com Home
File Upload Progress Home
File Upload Progress Home
Download
Site Map
Examples
- 11
Default settings
Show uploaded files names
Client-side events handling
Another style
Localization
Custom time format
Preserve space
Allowed file extensions and sizes
StatusPanel
control use
Add/delete file inputs
Cancel data transmitting
Customize
- 2
Custom style file
Custom localization file
Configuration
- 4
obout_FileUpload DLL
Web Configuration
- 3
UploadProgressModule
UploadProgressHandler
Optional settings
Knowledge Base
- 1
Knowledge Base
Documentation
- 5
Server side properties
Client side interface
- 3
OnClientProgressRefreshed
OnClientFileCleared
OnClientFileRejected
Upload large files
ChangeLog
Products
AJAX Page
Calendar
Color Picker
Date Picker
File Upload Progress
Flyout
Grid
HTML Editor
Image Zoom
Listbox
Multilevel Listbox
Scheduler
Show
Spell Checker
Splitter
Tab Strip
TreeView
Tree_DB
Window
Menu
Context Menu
Easy Menu
Slide Menu
Text Menu
Combobox
Combobox
AJAX Autosuggest
Multilevel Combobox
State Selector
Interface Controls
Button
Checkbox
Dropdown List
Multiline Textbox
Radio Button
Textbox
ASP.NET MVC
Interface Controls
Download
Download page
Install FAQ
Tech Support
Our clients
Testimonials
Support
Support
Purchase
Purchase page
Contact Sales
License info
Sales FAQ
Customer login
Print Invoice
Installation
Company
Legal
Clients
Testimonials
Contact