Salut
j'ai un problème dans l'affichage d'une image voila le code merci
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
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Document sans titre</title>
</head>
 
<body>
       <?php
	        try {
    $connexion=new PDO("mysql:host=localhost;dbname=image",'root','');
} catch (Exception $exc) {
 
    die($exc->getMessage());
}
 
// Testons si le fichier a bien été envoyé et s'il n'y a pas d'erreur
if (isset($_FILES['monfichier']) AND $_FILES['monfichier']['error']== 0)
{
// Testons si le fichier n'est pas trop gros
if ($_FILES['monfichier']['size'] <= 7000000)
{
// Testons si l'extension est autorisée
$infosfichier =pathinfo($_FILES['monfichier']['name']);
$extension_upload = $infosfichier['extension'];
$extensions_autorisees = array('jpg', 'jpeg', 'gif','png','docx');
if (in_array($extension_upload,$extensions_autorisees))
{
// On peut valider le fichier et le stocker définitivement
$requete=$connexion->prepare("insert into photo values(?,?)");
$requete->execute(array('',$_FILES['monfichier']['name']));
}
}
}
$requete1=$connexion->query("select*from photo where id=1");
$resultat=$requete1->fetch();
?>
 
<form id="blob" name="blob" method="post" action="<?php $_SERVER['PHP_SELF'] ?>" enctype="multipart/form-data">
<label>Image</label><input type="file" name="monfichier" />
 
<input type="submit" value="uploader" />
 
</form>
<table>
<tr>
 
<td><?php echo $resultat['img']; ?></td>
</tr>
 
</table>
 
</body>
</html>