Aurigma Image Uploader 6.5 Dual
Robust Upload Sample
This demo application shows how to verify integrity of uploaded files.
The application highlights the following features:
- Verification of file integrity.
- Adding custom buttons without extra HTML.
- Automatic connection recovery.
Adding Hash Calculation
The check, whether the received files contain errors, is performed using hash calculation. To enable it in Image Uploader, set the value of the HashAlgorithm property to the required algorithm name. You can specify several algorithms (as it is done in this application). An appropriate hash value will be calculated and uploaded to the server along with a file. After that you can calculate hash value on the server and compare it with one generated by Image Uploader. For more details about hash calculation, see the Robust Upload Using Hash topic.
Figure 1. Application appearance of the ActiveX version.
In this sample, standard Image Uploader buttons are replaced without writing extra HTML code. They are simply replaced with the specified images. To replace the buttons as in this demo, add the following initialization properties:
And to prevent the control from reloading button images every time the user refreshes the page, enable caching of GUI controls using the CacheGuiGraphics property. The property GuiGraphicsVersion holds the version of cached images. If you want to reload them, increase this value. For more details about button replacing, see the Customizing Buttons topic.
Automatic connection recovery
Conditions for automatic connection recovery are specified using the AutoRecoverTimeOut and AutoRecoverMaxTriesCount properties. For more details about connection recovery, see the Configuring Automatic Upload Recovery topic.
To complete the upload started by Image Uploader, some actions on the server side should be performed. The upload script of this application is based on to the corresponding script of the Basic Demo Sample. The difference is that the script calculates hash values before saving files. It is done in the following way:
- For each uploaded file, the script reads the POST fields that contain hash values. They are HashCodeSHA_1, HashCodeMD5_1, and HashCodeMD2_1 in this sample.
- Hash values are re-calculated on the server using standard means of the server platform or third-party libraries.
- Values generated on the server and received along with files are compared. If they are not equal, an error will be returned.
- If the values are equal, the file will be saved.
- HashAlgorithm Property
- ButtonAddFoldersImageFormat Property
- ButtonAddFilesImageFormat Property
- ButtonSendImageFormat Property
- CacheGuiGraphics Property
- GuiGraphicsVersion Property
- FilesPerOnePackageCount Property
- AutoRecoverTimeOut Property
- AutoRecoverMaxTriesCount Property