Index: /extensions/pLoader/trunk/src/Uploader/ImageList.pm
===================================================================
--- /extensions/pLoader/trunk/src/Uploader/ImageList.pm	(revision 4290)
+++ /extensions/pLoader/trunk/src/Uploader/ImageList.pm	(revision 4291)
@@ -1078,5 +1078,4 @@
         )
     );
-    $self->progress_msg_details_refresh(" ");
 }
 
Index: /extensions/pLoader/trunk/src/Uploader/PWG/WebServices.pm
===================================================================
--- /extensions/pLoader/trunk/src/Uploader/PWG/WebServices.pm	(revision 4290)
+++ /extensions/pLoader/trunk/src/Uploader/PWG/WebServices.pm	(revision 4291)
@@ -61,4 +61,8 @@
            upload_high
            chunk_size
+           sum_high_file
+           sum_resized_file
+           sum_thumb_file
+           sum_original_file
       / 
 );
@@ -239,113 +243,54 @@
     my ( $self, $progress ) = @_;
 
-    my $file_sum;
-
-    my $yield = $progress->{yield};
-    $yield->();
-    $progress->{msg_details}->(
-            sprintf(
-                "%s : %s", 
-                $progress->{checksum_msg}, 
-                $self->site_resized_file
-            )
-        );
-    eval {
-        $file_sum = file_md5_hex(
-            $self->site_resized_file
-        );
-    };
-    $yield->();
+    $self->sum_resized_file(
+        $self->_checksum(
+            $self->site_resized_file,
+            $progress
+        )
+    );
+
+    $self->sum_thumb_file(
+        $self->_checksum(
+            $self->site_thumb_file,
+            $progress
+        )
+    );
  
-    $progress->{msg_details}->(
-            sprintf(
-                "%s : %s", 
-                $progress->{checksum_msg}, 
-                $self->site_thumb_file
-            )
-        );
-    my $thumbnail_sum = file_md5_hex(
-        $self->site_thumb_file,
-    );
-   $yield->();
- 
-    $progress->{msg_details}->(
-            sprintf(
-                "%s : %s", 
-                $progress->{checksum_msg}, 
-                $self->site_high_file
-            )
-        );
- 
-    my $original_sum = file_md5_hex(
-        $self->site_high_file
-    );
-
-    my $form = {
-        method            => 'pwg.images.exist',
-        md5sum_list       => $original_sum,
-    };
-
-    $yield->();
-    my $result = $self->uagent->post(
-        $self->urlbase.'/ws.php?format=json',
-        $form
-    );
-    $yield->();
-
-    my $hresult = {};
-        eval {
-            $hresult = from_json(
-                $result->{_content}
-            );
-        };
+    $self->sum_high_file(
+        $self->_checksum(
+            $self->site_high_file,
+            $progress
+        )
+    );
+    # is the same in pLoader but may be different 
+    $self->sum_original_file(
+        $self->sum_high_file
+    );
+
 
     my $site_image_name = $self->site_image_name; 
 
-    my $image_id = $hresult->{result}{$original_sum};
+    my $image_id = $self->_exists($self->sum_original_file);;
     my $status = 0;
     my $status_line = "An error has occured during upload.";
     my $content = {};
+    my $doubleCheck;
+    my $form;
     while(1){
         if(!defined($image_id)){
         	
-            my $resized_params = {
-                filepath       => $self->site_resized_file,
-                type           => 'file',
-                original_sum   => $original_sum,
-            };
-
-            $progress->{current_msg} = $progress->{resized_msg};
-            $yield->();
-            $self->send_chunks(
-                $resized_params,
-                $progress,
-            );
-            $yield->();
-
+            my $resized_params = $self->_send_chunks('file', $progress);
             $status_line = $resized_params->{message};
             last if !$resized_params->{ok};
           
-            my $thumb_params = {
-                filepath       => $self->site_thumb_file,
-                type           => 'thumb',
-                original_sum   => $original_sum,        	
-            };
-    
-            $progress->{current_msg} = $progress->{thumbnail_msg};
-            $yield->();
-            $self->send_chunks(
-                $thumb_params,
-                $progress,
-            );
-            $yield->();
+            my $thumb_params = $self->_send_chunks('thumb', $progress);
             $status_line = $thumb_params->{message};
             last if !$thumb_params->{ok};
-
        	
             $form = {
                 method            => 'pwg.images.add',
-                original_sum      => $original_sum,
-                file_sum          => $file_sum,
-                thumbnail_sum     => $thumbnail_sum,
+                original_sum      => $self->sum_original_file,
+                file_sum          => $self->sum_resized_file,
+                thumbnail_sum     => $self->sum_thumb_file,
                 categories        => $self->categories,
                 name              => $site_image_name,
@@ -357,22 +302,11 @@
                 
             };
-            my $high_params = {
-                filepath       => $self->site_high_file,
-                type           => 'high',
-                original_sum   => $original_sum,
-            };
     
             if($self->upload_high){
-                $form->{high_sum} = $original_sum;
-                $progress->{current_msg} = $progress->{highdef_msg};
-                $yield->();
-                $self->send_chunks(
-                    $high_params,
-                    $progress
-            	);
-                $yield->();
+                my $high_params = $self->_send_chunks('high', $progress);
                 $status_line = $high_params->{message};
                 last if !$high_params->{ok};
             }
+            $doubleCheck = 1;
         }
         else {
@@ -388,5 +322,5 @@
                 tag_ids           => $self->site_tags,
             };
-            $yield->();
+            $progress->{yield}->();
         }
 
@@ -394,6 +328,6 @@
         delete $form->{tag_ids} if '' eq $self->site_tags;
 
-        $yield->();
-        $result = $self->uagent->post(
+        $progress->{yield}->();
+        my $result = $self->uagent->post(
             $self->urlbase.'/ws.php?format=json',
             $form
@@ -409,4 +343,8 @@
         $status_line = $result->status_line; 
 
+        if($doubleCheck){
+            $content->{stat} = 'fail' if !$self->_exists($self->sum_original_file); 
+        }
+
         last;
     }
@@ -414,5 +352,86 @@
     return ( $status,  $status_line, $content);
 }
- 
+
+sub _exists {
+    my ( $self, $md5_sum ) = @_;
+
+    my $form = {
+        method            => 'pwg.images.exist',
+        md5sum_list       => $md5_sum,
+    };
+
+    my $result = $self->uagent->post(
+        $self->urlbase.'/ws.php?format=json',
+        $form
+    );
+
+    my $hresult = {};
+    eval {
+        $hresult = from_json(
+            $result->{_content}
+        );
+    };
+    my $id;
+    $id = $hresult->{result}{$self->sum_original_file} if 'ok' eq $hresult->{stat};
+    
+    $id;
+} 
+
+sub _checksum {
+    my ( $self, $file, $progress ) = @_;
+    my $file_sum;
+
+    my $yield = $progress->{yield};
+
+    $yield->();
+    $progress->{msg_details}->(
+        sprintf(
+            "%s : %s", 
+            $progress->{checksum_msg}, 
+            $file
+        )
+    );
+    eval {
+        $file_sum = file_md5_hex(
+            $file
+        );
+    };
+    $yield->();
+
+    $file_sum;
+}
+
+sub _send_chunks {
+    my ( $self, $type, $progress ) = @_;
+
+    my $msg = {
+        thumb=>'thumbnail_msg',
+        file=>'resized_msg',
+        high=>'highdef_msg',
+    };
+
+    my $filepath = {
+        thumb=>$self->site_thumb_file,
+        file=>$self->site_resized_file,
+        high=>$self->site_high_file,
+    };
+
+    $progress->{current_msg} = $progress->{$msg->{$type}};
+    $progress->{yield}->();
+
+    my $params = {
+         filepath      => $filepath->{$type},
+         type          => $type,
+         original_sum  => $self->sum_original_file,
+    };
+
+    $self->send_chunks(
+       $params,
+       $progress,
+    );
+    $progress->{yield}->();
+
+    $params;
+}
 
 sub AddCategories{
