Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
marcossss  
#1 Posted : Tuesday, August 9, 2011 2:52:29 AM(UTC)
marcossss

Rank: Newbie

Groups: Member
Joined: 8/9/2011(UTC)
Posts: 1

Hi,

I noticed that during upload, if there is a connection error (in my case, I restart the Apache mod_perl module), the entire upload of the current file restart from the beginning and not restart from where it arrived.

For example by uploading a file of 1GB, if the error occurs at around 500MB, the upload restarts from 0 kB.

I think this behavior is not correct, right?

This is my client side code:

Code:

<form type="multipart/form-data" method="post">
<script type="text/javascript">
//<![CDATA[
//Create JavaScript object that will embed Image Uploader to the page.
var iu = new ImageUploaderWriter("ImageUploader1", 810, 475);
//For ActiveX control full path to CAB file (including file name) should be specified.
iu.activeXControlCodeBase = "/uploads/82/85/8285fecc01bce007ada9d6c5101a761f/ImageUploader6.cab";
iu.activeXControlVersion = "6,5,6,0";

//For Java applet only path to directory with JAR files should be specified (without file name).
iu.javaAppletJarFileName = "/uploads/19/85/1985296142c5459186e8ef0cab5035fd/ImageUploader6.jar";
iu.javaAppletCached = true;
iu.javaAppletVersion = "6.5.6.0";
iu.addParam("PaneLayout", "ThreePanes");
iu.addParam("TreePaneWidth", "150");
iu.addParam("FolderPaneHeight", "300");
iu.addParam("TreePaneBorderStyle", "FixedSingle");
iu.addParam("FolderPaneBorderStyle", "FixedSingle");
iu.addParam("UploadPaneBorderStyle", "FixedSingle");
iu.addParam("BackgroundColor", "#D4D4D4");
iu.addParam("UploadPaneBackgroundColor", "#F0FFFF");
iu.addParam("FolderView", "Thumbnails");
iu.addParam("UploadView", "AdvancedDetails");

iu.addParam("FilesPerOnePackageCount", "1");
iu.addParam("MaxConnectionCount", "3");
iu.addParam("AutoRecoverMaxTriesCount", "6");
iu.addParam("AutoRecoverTimeOut", "10000");

iu.addParam("LargePreviewWidth", "640");
iu.addParam("LargePreviewHeight", "480");
iu.addParam("AllowRotate", "false");
iu.addParam("AllowMultipleRotate", "false");
iu.addParam("AllowFolderUpload", "false");
iu.addParam("IncludeSubfolders", "true");
iu.addParam("ShowDescriptions", "false");
iu.addParam("ShowDebugWindow", "true");
iu.addParam("ShowSubfolders", "true");

iu.addParam("FileMask", "*.jpg;*.jpeg;*.jpe;*.tif;*.tiff");
//Configure License Keys
iu.addParam("LicenseKey", "xxx");

//Configure thumbnail settings.
iu.addParam("UploadThumbnail1FitMode", "Fit");
iu.addParam("UploadThumbnail1Width", "600");
iu.addParam("UploadThumbnail1Height", "600");
iu.addParam("UploadThumbnail1JpegQuality", "100");

iu.addParam("UploadThumbnail2FitMode", "Fit");
iu.addParam("UploadThumbnail2Width", "120");
iu.addParam("UploadThumbnail2Height", "94");
iu.addParam("UploadThumbnail2JpegQuality", "100");

//Max file upload allowed
iu.addParam("MaxFileCount", "-1");

//Configure URL files are uploaded to.
iu.addParam("Action", "/app/uploader/upload_target");

//Configure URL where to redirect after upload.
iu.addParam("RedirectUrl", "");
//addtional info
iu.addParam("AdditionalFormName", "orderInfo");

//client side events
iu.addEventListener("AfterUpload", "ImageUploader1_AfterUpload");

//Create installation progress.
var ip = new InstallationProgressExtender(iu);
ip.setProgressImageUrl("/uploads/82/f6/82f6b6a6f7867fe916ded90f8fca2a49/installationprogress.gif");
ip.setProgressCssClass("ScreenStyle");
ip.setInstructionsCssClass("ScreenStyle");

//Tell Image Uploader writer object to generate all necessary HTML code to embed
//Image Uploader to the page.
iu.writeHtml();
//]]>
</script>
</form>

And my perl function:

Code:

sub save_uploaded_files {
	my ($session, $id_ordine, $sigla_paese, $process) = @_;  

	my $dirOriginalImages = getProjectPath($session, $id_ordine, $sigla_paese);
	
	my $dirThumb1 = $dirOriginalImages."/thumbnails";
	my $dirThumb2 = $dirThumb1."/small";
	
	make_path($dirThumb1,$dirThumb2);	
	
	#Physical path to the gallery folder
	$absGalleryPath = $dirOriginalImages;
	$absThumbnailsPath1 = $dirThumb1;
	$absThumbnailsPath2 = $dirThumb2;
	
	#Get total number of uploaded files (all files are uploaded in a single package).
	my $fileCount = param("FileCount");
	

	my @filesFunded = <$dirOriginalImages/*.*>;
	#contatore per gestire file aggiunti
	my $count = @filesFunded;
	
	#Iterate through uploaded data and save the original file
	for (my $i = 1; $i <= $fileCount; $i++){
		#Get source file and save it to disk.
		my $sourceFilePath = param("SourceFile_" . $i);
		my $fileName = "";
		
	
		$fileName = get_safe_file_name(sprintf("%05s",($i+$count)).'_'.$sourceFilePath);


		#Copy file to gallery folder
		open(OUT, ">" . File::Spec->join($absGalleryPath, $fileName));
		binmode(OUT);  
		while (<$sourceFilePath>) {   
			print OUT $_;   
		}  
		close(OUT);
		       
		#Get first thumbnail (the single thumbnail in this code sample) and save it to disk.
		my $thumbnail1Path = param("Thumbnail1_" . $i);
		#Copy file to thumbnails folder
		open(OUT, ">" . File::Spec->join($absThumbnailsPath1, $fileName . ".jpg")); 
		binmode(OUT);  
		while (<$thumbnail1Path>) {   
			print OUT $_;   
		}  
		close(OUT);	
		
		#Get second thumbnail (the single thumbnail in this code sample) and save it to disk.
		my $thumbnail2Path = param("Thumbnail2_" . $i);
		#Copy file to thumbnails folder
		open(OUT, ">" . File::Spec->join($absThumbnailsPath2, $fileName . ".jpg")); 
		binmode(OUT);  
		while (<$thumbnail2Path>) {   
			print OUT $_;   
		}  
		close(OUT);	
		
	}
	
	return undef;
	   
}

Edited by user Tuesday, August 9, 2011 2:53:42 AM(UTC)  | Reason: Not specified

p.shirykalova  
#2 Posted : Tuesday, August 9, 2011 3:38:55 AM(UTC)
p.shirykalova

Rank: Advanced Member

Groups:
Joined: 7/13/2011(UTC)
Posts: 286

Thanks: 6 times
Was thanked: 31 time(s) in 31 post(s)
Hello,

There is nothing wrong with your code, such behaviour of Image Uploader v6 is expected.

Image Uploader v7 offers Chunk Upload to prevent re-uploading of the file from the beginning.

This feature allows you to divide your file into parts of specified size (chunkSize) and send each part in separate HTTP request. So after uploading failure the uploading process will be resumed from the incomplete chunk.

As far as you use v6 and have FilesPerOnePackageCount=1, your upload process will be resumed from the incomplete file (if you are uploading multiple files).

So to be able to use Chunk Upload please update your Image Uploader to the leates version. For more information please contact our Sales Team.

Best regards,

Pauline Shirykalova

Aurigma Technical Support

Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.