upload_image.php
1.74 KB
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
<HTML>
<HEAD><link rel="stylesheet" type="text/css" href="page.css"></HEAD>
<BODY>
<div id="container">
<form enctype ="multipart/form-data" action ="menu.php" method="POST">
<?php
$uploaddir='/wamp/www/tests/private/';
$uploadfile= $uploaddir. basename($_FILES['photo']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['photo']['tmp_name'],$uploadfile))
{
echo"La fiche est valide et a été crée avec succés";
}
echo'</pre>';
$file = fopen($nom=$_POST['nom_medoc'].".html","w");
fwrite($file,"<HTML><br>");
fwrite($file,"\r\n");
fwrite($file,"<HEAD><link rel=stylesheet type=text/css href=page.css></HEAD><br>");
fwrite($file,"\r\n");
fwrite($file,"<BODY><br>");
fwrite($file,"\r\n");
fwrite($file,"<div id=container><br>");
fwrite($file,"\r\n");
fwrite($file,"<div id=header>");
fwrite($file,"\r\n");
fwrite($file,"<h1>Site internet du CHR de Lille</h1></div><br>");
fwrite($file,"\r\n");
fwrite($file,"<div id=menu><h2>Menu</h2><ul><li><a href=./menu.php>Retour au menu</a></li></ul></div>");
fwrite($file,"<div id=contents>");
fwrite($file,"<a name=content></a><h2>$_POST[nom_medoc]($_POST[molecule])</h2>");
fwrite($file,"\r\n");
fwrite($file,"<p><img class=imagefloat src=./$_POST[nom_medoc].jpg alt=$_POST[nom_medoc] width=150 height=150 /></p>");
fwrite($file,"<br/>");
fwrite($file,"<a name=content></a><h2>Posologie</h2>");
fwrite($file,"$_POST[posologie]");
fwrite($file,"<a name=content></a><h2>Indications</h2>");
fwrite($file,"$_POST[indic]</form>
</BODY>
</HTML>");
fwrite($file,"</div></div></BODY>");
fwrite ($file,"</HTML>");
fclose($file);
?>
<input type="submit" value="retour au menu" name="retour"/>
<?php
if(isset($_POST['retour']))
header('location:./liste_fiche.php');
?>
</BODY>
</HTML>