<td>Upload File::</td>
<td><input type="file" value="file" name="file" /></td>
</tr>
<tr>
<td><input type="submit" name="submit" value="submit" /></td>
</tr>
</table></form></body>
</html>
<?php
if(isset($_POST['submit']))
{
$name=$_POST['name'];
$email=$_POST['email'];
$file1=$_POST['file'];
$sql=mysql_query("insert into admin_table values('','$name','$email','$file1')");
//echo "insert into admin_table values('','$name','$email','$file1')";
}
?>
the file is not a post object, you need to access the server global variables rather than the post. I.e.: W3Schools has a pretty comprehensive simple file upload procedure, you can read about it here:http://www.w3schools.com/php/php_file_upload.asp
Any file you POST is available in $_FILES, $_POST conatin any other string data you send
you don,t have to mention the value as it will simply browse the files
you cannot use the ordinary post using file as object... because that gives a null value...
try
$var = $_FILES["file"]["name"];
then insert it in your database
put a "@"
before $_POST like @$_POST_["sample"];
error_reporting(E_ALL & ~E_NOTICE);
use <form action="" name="ff" enctype="multipart/form-data"> to upload image
0 Comments
Please add nice comments or answer ....