Won't upload something in the way can you help me ???
Posted: Sun May 14, 2006 12:27 pm
Good day to you all !
I have a problem uploading on file from my code.
I dont know where to put the the upload code
Php 4
windows 2003
Here is my upload code :
I have a problem uploading on file from my code.
I dont know where to put the the upload code
Php 4
windows 2003
Code: Select all
<?php
if (!isset($_POST['submit']))
{
?>
<!doctype html public "-//w3c//dtd html 3.2//en">
<html>
<head>
</head>
<body bgcolor="#000000" text="white" vlink="orange" link="white" alink="yellow" >
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" >
Nom : <input type="text" name="nom"><br>
Date d'affichage : <input type="text" name="affiche"><br>
Courriel : <input type="text" name="courriel"><br>
Évènement : <input type="text" name="evenement"><br>
Date de l' évènement : <input type="text" name="date"><br>
<input type="hidden" name="MAX_FILE_SIZE" value="200000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" name="submit" value="Submit">
</form>
</body>
</html>
<?php
}else{
?>
<!doctype html public "-//w3c//dtd html 3.2//en">
<html>
<head>
</head>
<body bgcolor="#000000" text="white" vlink="black" link="black" alink="black" >
<br><br>
<b>Voici votre résultat <?php echo $_POST['nom']; ?> :</b><hr>
<table border="0" align="center" cellspacing="1" cellpading="0" >
<tr><td bgcolor="#000000" class="white" align="center"><table border=0 align="center" cellspacing="1" cellpading="0" >
<tr><td bgcolor="#cccc99" class="white" align="left" width="500">
Nom : <?php echo $_POST['nom']; ?><br>
Date d'affichage : <?php echo $_POST['affiche']; ?><br>
Courriel : <?php echo $_POST['courriel']; ?><br><br>
Évènement : <?php echo $_POST['evenement']; ?><br>
Date de l' evenement : <?php echo $_POST['date']; ?>
</td>
<td bgcolor="#cccc99" class="white" align="left" width="100"><img src="<?php echo "http://www.test.peuplies.info/AAA Model Editor/upload/".$_POST['uploadedfile']; ?>" width="100" border="0">
</td>
</tr>
</table>
</table>
<br><br>
<hr>
<form action="addtest11write.php?codes=codesource" method="POST">
<center>
<textarea cols="80" rows="20" wrap="off" name="codesource" >
<table border="0" align="center" cellspacing="1" cellpading="0" >
<tr><td bgcolor="#000000" class="white" align="center"><table border="0" align="center" cellspacing="1" cellpading="0" >
<tr><td bgcolor="#cccc99" class="white" align="left" width="500">
Nom : <?php echo $_POST['nom']; ?><br>
Date d'affichage : <?php echo $_POST['affiche']; ?><br>
Courriel : <?php echo $_POST['courriel']; ?><br><br>
Évenement : <?php echo $_POST['evenement']; ?><br>
Date de l' evenement : <?php echo $_POST['date']; ?><br>
</td>
<td bgcolor="#cccc99" class="white" align="left" width="100"><img src="<?php echo "http://www.test.peuplies.info/AAA Model Editor/upload/".$_POST['uploadedfile']; ?>" width="100" border="0">
</td>
</tr>
</table>
</table>
</textarea>
</center>
<input type="submit" name="confirm" value="Confirm">
</form>
</body>
</html>
<?php
}
?>Here is my upload code :
Code: Select all
// Where the file is going to be placed
$target_path = "uploads/";
/* Add the original filename to our target path. Result is "uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
// This is how we will get the temporary file...
$_FILES['uploadedfile']['tmp_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!";
}