> Online tutorial : change button color in javascript
Showing posts with label change button color in javascript. Show all posts
Showing posts with label change button color in javascript. Show all posts

How do Upload File using PHP

How do Upload File using PHP

In PHP we are using two file which used upload file in the server.First one Html file and another one is PHP file .

In the Html file we are going get file content and PHP file we are process it and Upload into Particular file path.

Coding

In the coding section we are show First html file.In the html file we are going to get file and sent to php file using POST method.Here code for HTML file.


Upload.html:

1)In the form enctype/form data encding when submitting to the server.


<html>
<body>
<form enctype="multipart/formdata" action="saveupload.php" method="post">
<input type="file" name="fileToUpload">
<input type="submit" value="UploadFile">
</form>
</body>
</html>

saveupload.php:


1)$_FILES["file"]["name"] it is used get the name of file
2)$_FILES["file"]["type"] it is used to get type of file  
3)$_FILES["file"]["size"]  it is used to get size of file 
4)$_FILES["file"]["tmp_name"]  it is give tmp name of file which is ued to store the file in folder.


<?php

echo "<table border=\"1\">";
echo "<tr><td>Client Filename: </td>

   <td>" . $_FILES["file"]["name"] . "</td></tr>";

echo "<tr><td>File Type: </td>
   <td>" . $_FILES["file"]["type"] . "</td></tr>";
echo "<tr><td>File Size: </td>
   <td>" . ($_FILES["file"]["size"] / 1024) . " Kb</td></tr>";
echo "<tr><td>Name of Temp File: </td>
   <td>" . $_FILES["file"]["tmp_name"] . "</td></tr>";
echo "</table>";

move_uploaded_file($_FILES["file"]["tmp_name"], "C:/upload/" . $_FILES["file"]["name"]);

?>

move_uploaded_file(dest_file,source_file)

Here Upload is folder we can create in you local computer it is save the file. 

change button color in javascript

change button color in javascript

In the program we will show you How do change button color using javascript .In javascript we are using onmouseover it is used to record mouse move.


Source code




<html>
<head>
<script type="text/javascript">
function changeColor(color)
{
document.getElementById('MyButton').style.background=color;
}
</script>
</head>
<body>
<p>Move mouse over the color string</p>
<table width="60%">
<tr>
<td bgcolor='red' onmouseover="changeColor('red')">RED</td>

<td bgcolor='yellow' onmouseover="changeColor('yellow')">YELLOW</td>

<td bgcolor='aqua' onmouseover="changeColor('aqua')">AQUA</td>
</tr>
</table>
<form>
<input id="MyButton" type="button" value='changing color of buttons'>
</form>
</body>
</html>