File uploading
Posted: Tue Apr 01, 2008 7:01 pm
HI my name is alaa Iam a beginner in the php language and Iam using wamp server. Please I have a question in file uploading first of all I went to my php.ini and made sure that the file uploading was on and made a directory c:/wamp/tmp
and then I went to the editor and wrote the following html
and when I ran the programme and choose my file which Iwant to upload he always sent me the message Sorrrrrry so please I want to know what is wrong?????????
and then I went to the editor and wrote the following html
Code: Select all
<html>
<body>
<form method="POST" action="2.php" >
<b><i>Choose your file :
<input type="file" name="img1" size=20>
<br>
<input type="submit" value="Upload">
</body>
</html>
and I wrote a php code in the 2.php file and was :
<?php
if($_FILES[img1]!="")
{
@copy($_FILES[img1][tmp_name],"c:/wamp/tmp".$_FILES[img1][name]) or die("Sorry");
}
else
{
die("Sorrrrrry");
}
?>
<html>
<body>
The file size is <?$_FILES[img1][size]?>
</body>
</html>