Bonjour,

Je désire importer un fichier pdf sur ma page Web. J'ai trouvé ce code php que j'ai adapté à ma solution et qui fonctionne très bien avec tous les types de documents: txt, png, docx, mais pas avec les fichiers pdf.

Je ne sais pas pourquoi !

Je serai vraiment reconnaissante à qui pourra m'aider ! Merci.

Ci-dessous, mon code :


Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<form enctype="multipart/form-data" action="upload.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000" />
Selectionner le fichier a importer: 
<input name="uploadedfile" type="file" /><br />
<input type="submit" value="Importer" />
</form>
<?php
$target_path = "Archive/";
 
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 
 
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
    echo "The file ".  basename( $_FILES['uploadedfile']['name']). 
    " has been uploaded";
} else{
    echo "There was an error uploading the file, please try again!";
}
 
 
?>