Index: /extensions/PiwigoLib/PiwigoLib/Proxy/Helper/PwgBase64Helper.cs
===================================================================
--- /extensions/PiwigoLib/PiwigoLib/Proxy/Helper/PwgBase64Helper.cs	(revision 11902)
+++ /extensions/PiwigoLib/PiwigoLib/Proxy/Helper/PwgBase64Helper.cs	(revision 11903)
@@ -12,5 +12,7 @@
             try
             {
-                string encodedData = Convert.ToBase64String(encData_byte);
+                String encodedData = String.Empty;
+                encodedData = Convert.ToBase64String(encData_byte);
+                //encodedData = Encoding.UTF8.GetString(encData_byte, 0, encData_byte.Length);
                 return encodedData;
             }
Index: /extensions/PiwigoLib/PiwigoLib/Proxy/PwgImagesProxy.cs
===================================================================
--- /extensions/PiwigoLib/PiwigoLib/Proxy/PwgImagesProxy.cs	(revision 11902)
+++ /extensions/PiwigoLib/PiwigoLib/Proxy/PwgImagesProxy.cs	(revision 11903)
@@ -32,6 +32,6 @@
  * */
 
-        static internal PwgBaseProxyReponse pwg_images_add(String fileGuid, String thunbGuid, String HighresGuid, 
-            String imageGuid,  String imageFilename, String imageName, String imageAuthor, DateTime creationDate,  
+        static internal PwgBaseProxyReponse pwg_images_add(String fileMd5sum, String thunbMd5sum, String HighresMd5sum, 
+            String imageMd5sum,  String imageFilename, String imageName, String imageAuthor, DateTime creationDate,  
             String authorComment,List<String> lstCategories, List<String> lstTags, PwgConfidentLevelEnum? confidentLevel)
         {
@@ -42,8 +42,8 @@
                 data.Append("method=pwg.images.add");
                 Boolean firstOcc = false;
-                PwgProxyReponseHelper.buildQueryFromValue<String>(fileGuid, "file_sum", ref firstOcc, data);
-                PwgProxyReponseHelper.buildQueryFromValue<String>(thunbGuid, "thumbnail_sum", ref firstOcc, data);
-                PwgProxyReponseHelper.buildQueryFromValue<String>(HighresGuid, "high_sum", ref firstOcc, data);
-                PwgProxyReponseHelper.buildQueryFromValue<String>(imageGuid, "original_sum", ref firstOcc, data);
+                PwgProxyReponseHelper.buildQueryFromValue<String>(fileMd5sum, "file_sum", ref firstOcc, data);
+                PwgProxyReponseHelper.buildQueryFromValue<String>(thunbMd5sum, "thumbnail_sum", ref firstOcc, data);
+                PwgProxyReponseHelper.buildQueryFromValue<String>(HighresMd5sum, "high_sum", ref firstOcc, data);
+                PwgProxyReponseHelper.buildQueryFromValue<String>(imageMd5sum, "original_sum", ref firstOcc, data);
                 PwgProxyReponseHelper.buildQueryFromValue<String>(imageFilename, "original_filename", ref firstOcc, data);
                 PwgProxyReponseHelper.buildQueryFromValue<String>(imageName, "name", ref firstOcc, data);
Index: /extensions/PiwigoLib/PiwigoLib/Service/PwgImagesService.cs
===================================================================
--- /extensions/PiwigoLib/PiwigoLib/Service/PwgImagesService.cs	(revision 11902)
+++ /extensions/PiwigoLib/PiwigoLib/Service/PwgImagesService.cs	(revision 11903)
@@ -48,5 +48,5 @@
             return returnValue;
         }
-
+        
         public PwgImageAdded addImageByMultiPartForm(FileInfo fileImage, Int32? imageId, Int32? categoryId, String imageName, String imageAuthor, String imageComment, Int32? imageLevel, List<PwgTag> imageTags)
         {
@@ -89,12 +89,12 @@
             try
             {
-                String fileGuid =  uploadImageByChunk(lowResFile, PwgFileTypeEnum.LowRes);
-                String thunbGuid = uploadImageByChunk(thumbFile, PwgFileTypeEnum.Thumb);
-                String HighresGuid = uploadImageByChunk(highResFile, PwgFileTypeEnum.HighDef);
-                String imageGuid = (highResFile != null ? HighresGuid : fileGuid);  //Guid.NewGuid().ToString();
+                String fileMd5sum =  uploadImageByChunk(lowResFile, PwgFileTypeEnum.LowRes, null);
+                String thunbMd5sum = uploadImageByChunk(thumbFile, PwgFileTypeEnum.Thumb, fileMd5sum);
+                String HighresMd5sum = uploadImageByChunk(highResFile, PwgFileTypeEnum.HighDef, fileMd5sum);
+                String imageMd5sum = fileMd5sum; //(highResFile != null ? HighresMd5sum : fileMd5sum);  //Md5sum.NewMd5sum().ToString();
                 String imageFilename = (highResFile != null ? highResFile.Name : lowResFile.Name);
 
-                PwgBaseProxyReponse response = PwgImagesProxy.pwg_images_add( fileGuid, thunbGuid, HighresGuid, 
-                                                    imageGuid,  imageFilename, imageName, imageAuthor, creationDate,  
+                PwgBaseProxyReponse response = PwgImagesProxy.pwg_images_add( fileMd5sum, thunbMd5sum, HighresMd5sum, 
+                                                    imageMd5sum,  imageFilename, imageName, imageAuthor, creationDate,  
                                                     authorComment, lstCategories, lstTags, confidentLevel);
 
@@ -124,8 +124,8 @@
         }
 
-        public String uploadImageByChunk(FileInfo imageFile, PwgFileTypeEnum fileType)
+        public String uploadImageByChunk(FileInfo imageFile, PwgFileTypeEnum fileType, String InitialMd5sum)
         {
             byte[] buffer = new byte[5000];
-            string strGuid = String.Empty; ;
+            string strMd5sum = String.Empty; ;
             int read;
             int chunkNumber = 1;
@@ -136,11 +136,29 @@
                 {
                     FileStream fs = File.OpenRead(imageFile.FullName);
-                    strGuid = Com.Piwigo.Lib.Proxy.Helper.PwgBase64Helper.GetphpMd5Sum(fs);
+                    strMd5sum = Com.Piwigo.Lib.Proxy.Helper.PwgBase64Helper.GetphpMd5Sum(fs);
+                    // if not checksum was provide we use the one computed for transfert
+                    if (String.IsNullOrWhiteSpace(InitialMd5sum))
+                    {
+                        InitialMd5sum = strMd5sum;
+                    }
                     
                     fs.Seek(0, SeekOrigin.Begin);
-                    while ((read = fs.Read(buffer, 0, buffer.Length)) > 0)
-                    {
-                        String strB64Data = Com.Piwigo.Lib.Proxy.Helper.PwgBase64Helper.base64Encode(buffer);
-                        PwgBaseProxyReponse response = PwgImagesProxy.pwg_images_addChunk(strB64Data, strGuid, fileType, chunkNumber);
+                    while ((read = fs.Read(buffer, 0, 5000)) > 0)
+                    {
+                        byte[] truncBuffer;
+                        // si on est arriver àla fin du fichier et que le tableau fait moins de 50000 , on le tronque en le copiant
+                        // sinon on recopie l'adresse
+                        if (read < 5000)
+                        {
+                            truncBuffer = new Byte[read];
+                            Array.Copy(buffer, truncBuffer, read); 
+                        }
+                        else
+                        {
+                            truncBuffer = buffer;
+                        }
+
+                        String strB64Data = Com.Piwigo.Lib.Proxy.Helper.PwgBase64Helper.base64Encode(truncBuffer);
+                        PwgBaseProxyReponse response = PwgImagesProxy.pwg_images_addChunk(strB64Data, InitialMd5sum, fileType, chunkNumber);
 
                         chunkNumber += 1;
@@ -163,5 +181,5 @@
                 else
                 {
-                    strGuid = String.Empty;
+                    strMd5sum = String.Empty;
                 }
             }
@@ -170,5 +188,5 @@
                 throw new PwgServiceException("uploadImageByChunk : a error is raised by proxy.", ex);
             }
-            return strGuid;
+            return strMd5sum;
         }
 
Index: /extensions/PiwigoLib/TestPiwigoLib/Form1.cs
===================================================================
--- /extensions/PiwigoLib/TestPiwigoLib/Form1.cs	(revision 11902)
+++ /extensions/PiwigoLib/TestPiwigoLib/Form1.cs	(revision 11903)
@@ -74,14 +74,14 @@
                 //lstCat = PwgServiceProvider.Instance.PwgCategoriesService.GetAdminListOfCategory(); 
 
-                //FileInfo fiBig = new FileInfo("C:\\Users\\bayral\\Downloads\\49133_1636405570_2648232_n.jpg");
-                //FileInfo fiThumb = new FileInfo(MakeThumb(fiBig,"C:\\Users\\bayral\\Downloads\\49133_1636405570_2648232_n_thum.jpg",64));
-                //FileInfo fiLow = new FileInfo(MakeThumb(fiBig,"C:\\Users\\bayral\\Downloads\\49133_1636405570_2648232_n_low.jpg",256));
+                FileInfo fiBig = new FileInfo("C:\\Users\\bayral\\Downloads\\49133_1636405570_2648232_n.jpg");
+                FileInfo fiThumb = new FileInfo(MakeThumb(fiBig, "C:\\Users\\bayral\\Downloads\\49133_1636405570_2648232_n_thum.jpg", 64));
+                FileInfo fiLow = new FileInfo(MakeThumb(fiBig, "C:\\Users\\bayral\\Downloads\\49133_1636405570_2648232_n_low.jpg", 256));
 
-                FileInfo fiBig = new FileInfo("C:\\temp\\Oryx.jpg");
-                FileInfo fiThumb = new FileInfo(MakeThumb(fiBig, "C:\\temp\\Oryx_thumb.jpg", 64));
-                FileInfo fiLow = new FileInfo(MakeThumb(fiBig, "C:\\temp\\Oryx_low.jpg", 256));
+                //FileInfo fiBig = new FileInfo("C:\\temp\\Oryx.jpg");
+                //FileInfo fiThumb = new FileInfo(MakeThumb(fiBig, "C:\\temp\\Oryx_thumb.jpg", 64));
+                //FileInfo fiLow = new FileInfo(MakeThumb(fiBig, "C:\\temp\\Oryx_low.jpg", 256));
 
                 //PwgImageAdded imgAdd = PwgServiceProvider.Instance.PwgImagesService.addImageByMultiPartForm(fiBig, null, 1, "benoit", "byarl", "test upload", 0, new List<PwgTag>() { new PwgTag() { Name = "Benoit" }, new PwgTag() { Name = "Noé" } });
-                rc = PwgServiceProvider.Instance.PwgImagesService.addImage(fiBig, fiLow, fiThumb, "Benoit", "bayral", DateTime.Now, "demo", null, null, PwgConfidentLevelEnum.All);
+                rc = PwgServiceProvider.Instance.PwgImagesService.addImage(fiBig, fiLow, fiThumb, "Benoit", "bayral", DateTime.Now, "demo", new List<string>() { "1" }, new List<string>() { "Benoit" }, PwgConfidentLevelEnum.All);
                 //rc = PwgServiceProvider.Instance.PwgImagesService.DeleteImage(319, sess.SecurityToken);
 
