Hi,
I trying to creat code to upload images .in my code i can upload files but i cant upload images can any one tell me what is the problem in my code
this is my code
<?php
$command=$_POST["command"];
If($command == "") {
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML>
<HEAD>
<TITLE>File Uploading Interface</TITLE>
</HEAD>
<BODY>
<CENTER>
<BR><BR>
<FORM ENCTYPE="multipart/form-data" NAME=MyForm ACTION="" METHOD="POST">
<INPUT TYPE="hidden" NAME="command" VALUE="1">
<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="10000000000">
<TABLE>
<TR>
<TD>Choose File</TD>
<TD><INPUT NAME="MyFile" TYPE="File"></TD>
</TR>
<TR>
<TD COLSPAN="2"><INPUT NAME="submit" VALUE="Upload" TYPE="submit"></TD>
</TR>
</TABLE>
</FORM>
</CENTER>
</BODY>
</HTML>
<?php
} else {
$DestinationDir = "F:\wamp\www\surveys-html/";
$DestinationFile = $_FILES['MyFile']['name'];
if (move_uploaded_file($_FILES['MyFile']['tmp_name'], $DestinationFile)) {
echo "File uploaded successfully.";
} else {
switch($_FILES['MyFile']['error']) {
case 1 : echo "1The uploaded file exceeds the upload_max_filesize directive in php.ini.";
break;
case 2 : echo "1The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.";
break;
case 3 : echo "1The uploaded file was only partially uploaded.";
break;
case 4 : echo "1No file was uploaded.";
break;
case 6 : echo "1Missing a temporary folder.";
break;
case 7 : echo "1Failed to write file to disk";
break;
case 8 : echo "File upload stopped by extension";
break;
}
}
}
?>
thanks in advance
Punitha pary