This sample demonstrates several Huge-ASP file upload features.
Client-side preview of images - client-side JavaScript shows preview of an image when user choose some image.
Client can see images before upload
Client-side check of file extensions - File extensions are checked before upload. If the extension is not in '.gif,.jpg,.png,.jpeg,.bmp' list, client get a warning message.
Client-side check of file and form size - the source form size and size of each file field is checked BEFORE the form is sent. So the client do not need to send the form to see if the size of files/upload is correct.
- Limit for whole form is set to 4000000 Bytes
- Limit per file is set to 1500000 Bytes
Upload with progress bar - This script shows progress bar immediatelly after 'Upload' click. Client can immediatelly see that upload starts and then can see progress of the upload.
Server side checking for form and file size
- Limit for whole form is set to 4000000 Bytes
- Limit per file is set to 1500000 Bytes
Server side checking for file extensions and content-type File extensions are checked AFTER upload once again (to handle situation when client-side script is off). If the extension is not in '.gif,.jpg,.png,.jpeg,.bmp' list or content-type is not 'image/...', file is not stored on server-side
Server side checking of a file CONTENTS .gif,.jpg,.png,.jpeg,.bmp files have a special contents characteristics. This script also checks the CONTENTS of a file to be sure that the file is not an .exe renamed to .gif or .jpg. The file is stored ONLY if it is REALLY an image. (see IsImage function inside this source)
Save files with unique file names - each correct image file is stored. If same old-file exists on server-side, new file with the same name is stored with unique file name (GetUniqueFileName function inside this script)
Store upload info to a database - This script also stores info about upload and each uploaded file to a database
Send administrator email notification - This script creates an HTML report about upload and the report is sent to administrator email.
Destination folder is F:\Inetpub\vhosts\centrall.com.br\httpdocs\pure_upload\UploadFolder
See also:
List of samples
Base upload with progress bar
Progress bar gallery
Upload images with preview, progress and checking
Upload to email
|