37 lines
1.1 KiB
PHP
Raw Normal View History

2022-10-14 12:05:34 +02:00
<?php
2022-10-21 10:57:50 +02:00
$dl = false;
2022-10-14 12:05:34 +02:00
require('./config.php');
2022-10-21 10:57:50 +02:00
if(isset($_POST['Envoyer'])) {
if(!empty($_FILES['File'])) {
$fichier = $_FILES['File'];
$uploadDirectory = "./d/"; // fichier d'upload
$fileInfo = new SplFileInfo($_FILES['File']['name']); // préparation du fichier pour upload
$nouveauFichier = $fileInfo->getFilename();
$pathToSave = $uploadDirectory.$nouveauFichier;
move_uploaded_file($_FILES['File']['tmp_name'], $pathToSave);
openssl_sign(file_get_contents($pathToSave), $export, file_get_contents("./b/clePrivee"));
file_put_contents("./d/signature", $export);
$dl = true;
}
}
2022-10-14 12:05:34 +02:00
?>
<html>
2022-10-21 10:57:50 +02:00
<form method="POST" action="d.php" enctype="multipart/form-data">
<label for="File">Fichier : </label><input type="file" id="File" name="File" value=""/><br />
<input id="Envoyer" type="submit" name="Envoyer" value="Envoyer" />
2022-10-14 12:05:34 +02:00
</form>
2022-10-21 10:57:50 +02:00
<?php
if($dl) {
echo '<h2>Télécharger signature</h2>'
.'<a href ="./d/signature">Télécharger</a>';
}
?>
2022-10-14 12:05:34 +02:00
</html>