Sometimes connection problems occur during the uploading of files to server. However, such problems may be transient, and if it is the case, it would not be very convenient to interrupt the whole upload proccess and make the user start from scratch.

Image Uploader provides two properties allowing you to configure automatic upload resuming:

  • AutoRecoverMaxTriesCount - specifies the maximum number of upload attempts that Image Uploader will perform before completely stopping the upload process. This value includes the very first attempt and should be at least 1.
  • AutoRecoverTimeOut - specifies the interval in milliseconds between the attempts.

When resuming the upload, Image Uploader tries to resend the whole unsuccessful request. It means that if all the files are sent in one request, they all will be sent again, even if only the last one has failed. That is why we recommend you to send each file in a separate request. This behavior can be set using the FilesPerOnePackageCount property. Just set it to 1. In this case, all successfully uploaded images will not be resent.

Note

Another advantage of uploading files in separate requests is that it reduces the amount of memory used on the server to process the uploaded files. See the Uploading Files Sequentially and Concurrently topic for more details.

To use these properties, add the following lines to your initialization code.

JavaScript

<script type="text/javascript" src="iuembed.js">  </script>                       
<script type="text/javascript">

var iu = new ImageUploaderWriter("ImageUploader", 600, 500);

// ...Other params...
 
iu.addParam("FilesPerOnePackageCount", "1");
iu.addParam("AutoRecoverMaxTriesCount", "5");
iu.addParam("AutoRecoverTimeOut", "5000");

// ...Other params...

iu.writeHtml();

</script>