diff --git a/ecrire/action/joindre.php b/ecrire/action/joindre.php
index 53819bb1ab9aa5bf0f0b5b2fbfaba450c5e4e94f..1ec972d01a6100dc0dd0683659c8edad84f9da62 100644
--- a/ecrire/action/joindre.php
+++ b/ecrire/action/joindre.php
@@ -145,7 +145,11 @@ function spip_action_joindre3($path, $mode, $type, $id, $id_document,$hash, $red
 // http://doc.spip.org/@spip_action_joindre5
 function spip_action_joindre5($path, $mode, $type, $id, $id_document,$hash, $redirect, &$actifs)
 {
-	return ajouter_un_document($path, basename($path), $type, $id, $mode, $id_document, $actifs);
+	$pos = strpos($path, '/zip/');
+	if (!$pos) {
+		$pos = strpos($path, '/zip_');
+	}
+	return ajouter_un_document($path, substr($path, $pos+5), $type, $id, $mode, $id_document, $actifs);
 }
 
 // Zip a deballer.