Browse Source

gestion nom de fichier et recuperation zip

master
Samuel VERMEULEN 2 years ago
parent
commit
6bc17940d7
2 changed files with 8 additions and 7 deletions
  1. +3
    -3
      pdfseparate.php
  2. +5
    -4
      pdfseparate.sh

+ 3
- 3
pdfseparate.php View File

@@ -2,8 +2,8 @@
$target_dir = "/var/www/wordpress/scinder1pdf/pdf/";
$target_file = $target_dir . basename($_FILES["fichier"]["name"]);
move_uploaded_file($_FILES["fichier"]["tmp_name"], $target_file);
exec("/var/www/wordpress/scinder1pdf/pdfseparate.sh ".$_FILES["fichier"]["name"]);
echo "<a href='pdf/".$_FILES["fichier"]["name"].".zip'>Télécharger</a>";;
$zip = array();
exec("/var/www/wordpress/scinder1pdf/pdfseparate.sh ".$_FILES["fichier"]["name"], $zip);
echo "<a href='".end($zip)."'>Télécharger</a>";

?>

+ 5
- 4
pdfseparate.sh View File

@@ -1,8 +1,9 @@
#!/bin/bash

set -e

pdfseparate pdf/$1 pdf/$1"-%d.pdf"
zip pdf/$1.zip pdf/*pdf-*.pdf
mv pdf/*.pdf $(ls pdf/*.pdf |sed -e s/[é,è]/e/g -e s/' '/-/g)
pdf=$(ls pdf/*.pdf)
pdfseparate $pdf $pdf"-%d.pdf"
zip $pdf.zip $pdf-*.pdf
echo $pdf.zip

exit 0

Loading…
Cancel
Save