diff --git a/canapEPFL/cible.php b/canapEPFL/cible.php
index 693fb8dfb7b49191188a743a65b0b3253390945a..92ee6ac69508bd3dd8c8f61327d9cde7f1825a5a 100644
--- a/canapEPFL/cible.php
+++ b/canapEPFL/cible.php
@@ -31,8 +31,6 @@
           // TODO: check if i can pass only candidateData
           $candidateData = uploadAllFiles($filesPath, $candidateData->fichiers, $candidateData);
 
-          // print_r($candidateData->fichiers);
-
           // insert files in DB
           insertFiles($pdo, $candidateData->fichiers, $candidateId, $candidateData->rootpath);
 
diff --git a/canapEPFL/helpers.php b/canapEPFL/helpers.php
index 65e884e270840d822563132b92c48689323a87d2..73989d163b66b978e6e5e3063d50d41ba20eebc2 100644
--- a/canapEPFL/helpers.php
+++ b/canapEPFL/helpers.php
@@ -475,14 +475,29 @@ function updatePostulation ($pdo, $posted_data) {
   }
   insertTrainings($pdo, $to_add, $posted_data->id);
 
-// Update files
-foreach ($posted_files as $key => $file) {
-  $file_data = getOneFile($pdo, $file['id'], $posted_data->id);
-  if (!move_uploaded_file($file['tmp_name'], $file_data['file_path'])) {
-    // Erreur: Le fichier est ouvert
-    $_SESSION['edit_error']['files'] = "Erreur lors du remplacement du fichier" . $_FILES['file'.$i]['name'] . ", réessayez plus tard.";
+  // Update files
+  $sqlreq = "UPDATE file SET file_path=:file_path
+  WHERE fk_applicant_id=:applicant_id AND file_id=:file_id";
+
+  foreach ($posted_files as $key => $file) {
+    $file_data = getOneFile($pdo, $file['id'], $posted_data->id);
+    $extension = strtolower("." . pathinfo($file['name'])['extension']);
+    $path = preg_replace('/\\.[^.\\s]{3,4}$/', '', $file_data['file_path']) . $extension;
+
+    if (!move_uploaded_file($file['tmp_name'], $path)) {
+      // Erreur: Le fichier est ouvert
+      echo "err";
+      $_SESSION['edit_error']['files'] = "Erreur lors du remplacement d'un fichier, réessayez plus tard.";
+    } else {
+      // success, update db
+      $query = $pdo->prepare($sqlreq);
+      $query->bindParam(':applicant_id', $posted_data->id, PDO::PARAM_INT);
+      $query->bindParam(':file_path', $path, PDO::PARAM_STR);
+      $query->bindParam(':file_id', $file_data['file_id'], PDO::PARAM_STR);
+      $query->execute();
+      // TODO: old delete file ?
+    }
   }
-}
 // header('Location: viewpostulation.php');
 }
 #endregion
diff --git a/canapEPFL/templates/formParts/edit/annexes.php b/canapEPFL/templates/formParts/edit/annexes.php
index 135f01de178e51b6d6b1ee8e5924bf9bc7598f36..2b700dd7d8aaea979f5a6a10a5f1edcf96960e13 100644
--- a/canapEPFL/templates/formParts/edit/annexes.php
+++ b/canapEPFL/templates/formParts/edit/annexes.php
@@ -4,9 +4,7 @@
 <small>Remplacez ou ajouter des annexes (le fichier actuel est conservé si il n'est pas remplacé)</small>
 <br>
 <small>Formats autorisés: <b>PDF, JPG, JPEG, PNG</b></small>
-<!-- Annexes obligatoires -->
 <div class="form-group mt-3" id="files">
-
   <?php foreach ($files as $key => $file) {
     $name = preg_replace('/\\.[^.\\s]{3,4}$/', '', $file['file_name']);
   ?>
@@ -22,47 +20,5 @@
       <small class="error" class="form-text text-muted"></small>
     </div>
   <?php } ?>
-  <!-- / Annexes obligatoires -->
-  <!-- Annexes spécifiques -->
-  <!-- <div class="form-group" id="polyOnly">
-    <label for="gimch">Attestation de tests d'aptitudes GIM-CH (polymécanicien):</label>
-    <input type="file" name="gimch" class="upload-input" id="gimch" onchange="changeTitleFile(this)"/>
-    <br>
-    <label for="gimch" class="btn btn-secondary btn-sm icon-right">
-      Remplacer...
-    </label>
-    <br>
-    <small class="error" class="form-text text-muted"></small>
-  </div> -->
-
-  <!-- <div class="form-group" id="griTest">
-    <label for="griTestInput">Attestation de tests d'aptitudes GRI (informaticien):</label>
-    <input type="file" name="griTestInput" class="upload-input" id="griTestInput" onchange="changeTitleFile(this)"/>
-    <br>
-    <label for="griTestInput" class="btn btn-secondary btn-sm icon-right">
-      Remplacer...
-    </label>
-    <br>
-    <small class="error" class="form-text text-muted"></small>
-  </div> -->
-  <!-- / Annexes spécifiques -->
-  <!-- Annexes supplémentaires -->
-  <!-- <div class="form-group">
-    <table id="newCertifZone">
-      <tr>
-        <td>
-          <label for="certifs1">Certificats, diplômes et bulletins de notes des derniers 3-4 semestres:</label>
-          <input type="file" name="certifs1" class="upload-input" id="certifs1" onchange="changeTitleFile(this)"/>
-          <br>
-          <label for="certifs1" class="btn btn-secondary btn-sm icon-right">
-            Remplacer...
-          </label>
-          <br>
-          <small class="error" class="form-text text-muted"></small>
-        </td>
-      </tr>
-    </table>
-  </div> -->
   <button type="button" class="btn btn-primary btn-sm mt-3 mb-2" id="addInputFile">Ajouter une annexe</button>
-  <!-- region/ Annexes supplémentaires -->
 </div>
\ No newline at end of file