Search This Blog

Wednesday, 21 January 2015

Upload files in PHP.




<?php

if($_POST['Submit']=="Submit")

{

$target_path = "uploads/";

$imgnew_name=$_FILES['file']['name'];

$target_path = $target_path.basename($imgnew_name);

move_uploaded_file($_FILES['file']['tmp_name'], $target_path);
$msg="File uploaded...";
}
?>

<form id="form1" name="form1" method="post" action="" enctype="multipart/form-data">
<label>
<input name="file" type="file" id="file" />
</label>
<label>
<input type="submit" name="Submit" value="Submit" />
</label>
</form>
<?php echo $msg; ?>

No comments:

Post a Comment