Dear Friends,
I have a small problem....but hope you guys can help me out...I am unable to submit data into my database.
Here is the code......
filesubmit.htm
[HTML]<html>
<head>
<title>
My Test database file
</title>
</head>
<body>
<form method="POST" name="upload" action="dbtestf ilesubmit.php">
<p>
<input type="file" name="file" size="40"></p>
<p><input type="submit" value="Submit" name="submit">
<input type="reset" value="Reset" name="reset"></p>
</form>
</body>[/HTML]
dbtestfilesubmi t.php
[PHP]<?php
//Connect To Database
$hostname="mysq l.secureserver. net";
$username="mydb ";
$password="deep ak";
$dbname="mydb";
$usertable="tes t";
$yourfield = "file";
mysql_connect($ hostname,$usern ame, $password) OR DIE ("Unable to connect to database! Please try again later.");
mysql_select_db ($dbname);
$file = $_POST['file'];
//$file = "{$_FILES['file']['name']}";
$insert_query = ("INSERT INTO $usertable VALUES ('$file')");
if(!@mysql_quer y ($query)) {
echo mysql_error();
}else{
echo "<br>File". $_FILES['file']['name']." uploaded<br>";
}
?> [/PHP]
Please tell me where I am doing wrong.
Thanks
Deepak
I have a small problem....but hope you guys can help me out...I am unable to submit data into my database.
Here is the code......
filesubmit.htm
[HTML]<html>
<head>
<title>
My Test database file
</title>
</head>
<body>
<form method="POST" name="upload" action="dbtestf ilesubmit.php">
<p>
<input type="file" name="file" size="40"></p>
<p><input type="submit" value="Submit" name="submit">
<input type="reset" value="Reset" name="reset"></p>
</form>
</body>[/HTML]
dbtestfilesubmi t.php
[PHP]<?php
//Connect To Database
$hostname="mysq l.secureserver. net";
$username="mydb ";
$password="deep ak";
$dbname="mydb";
$usertable="tes t";
$yourfield = "file";
mysql_connect($ hostname,$usern ame, $password) OR DIE ("Unable to connect to database! Please try again later.");
mysql_select_db ($dbname);
$file = $_POST['file'];
//$file = "{$_FILES['file']['name']}";
$insert_query = ("INSERT INTO $usertable VALUES ('$file')");
if(!@mysql_quer y ($query)) {
echo mysql_error();
}else{
echo "<br>File". $_FILES['file']['name']." uploaded<br>";
}
?> [/PHP]
Please tell me where I am doing wrong.
Thanks
Deepak
Comment