Saturday, 29 October 2011

Upload source code of HTML



















<html>

A File Upload Script

<body>



if ( isset( $_FILES['fupload'] ) ) {

print "name: ". $_FILES['fupload']['name'] ."
";
print "size: ". $_FILES['fupload']['size'] ." bytes
";
print "temp name: ".$_FILES['fupload']['tmp_name'] ."
";
print "type: ". $_FILES['fupload']['type'] ."
";
print "error: ". $_FILES['fupload']['error'] ."
";

if ( $_FILES['fupload']['type'] == "image/gif" ) {

$source = $_FILES['fupload']['tmp_name'];
$target = "upload/".$_FILES['fupload']['name'];
move_uploaded_file( $source, $target );// or die ("Couldn't copy");
$size = getImageSize( $target );

$imgstr = "

;
$imgstr .= "src=\"$target\" alt=\"uploaded image\" />

";

print $imgstr;
}
}
?>

<form enctype="multipart/form-data"
action="" method="post">

"hidden" name="MAX_FILE_SIZE" value="102400" />
"file" name="fupload" />

"submit" value="upload!" />


form>
body>
html>

No comments:

Post a Comment