Hai friends,
Iam using windows XP in PHP when i upload file
its working but when i check size it is zero actually the size of the file is about 20kb so file is not uploading correctly is there any thing to do with PHP.ini file
if u have code for upload in windows i.e php+mysql upload.
please send me or correct this code.
my code is
<HTML>
<HEAD><TITLE>Store binary data into SQL Database</TITLE></HEAD>
<BODY>
<?php
if (isset($submit))
{
$home_path = " $dbserver="localhost";
$dbname="image";
$dbuser="root";
$dbpwd="";
@mysql_connect("$dbserver","$dbuser",""
@mysql_select_db($dbname);
$data = addslashes(fread(fopen($form_data, "r", filesize($form_data)));
//echo $dbuser;
$result="INSERT INTO binary_data (description,bin_data,filename,filesize,filetype) VALUES ('$form_description','$datanow','$form_data_name','$form_data_size','$form_data_type')";
$query=@mysql_query($result);
//echo $result."<br>";
//echo $query;
$id= mysql_insert_id();
print "<p>This file has the following Database ID: <b>$id</b>";
MYSQL_CLOSE();
}
else
{
?>
<form method="post" action="<?php echo $PHP_SELF; ?>" enctype="multipart/form-data">
File Description:<br>
<input type="text" name="form_description" size="40">
<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000000">
<br>File to upload/store in database:<br>
<input type="file" name="form_data" size="40">
<p><input type="submit" name="submit" value="submit">
</form>
<?php
}
?>
</BODY>
</HTML>
thanks and regards,
Nanban
Iam using windows XP in PHP when i upload file
its working but when i check size it is zero actually the size of the file is about 20kb so file is not uploading correctly is there any thing to do with PHP.ini file
if u have code for upload in windows i.e php+mysql upload.
please send me or correct this code.
my code is
<HTML>
<HEAD><TITLE>Store binary data into SQL Database</TITLE></HEAD>
<BODY>
<?php
if (isset($submit))
{
$home_path = " $dbserver="localhost";
$dbname="image";
$dbuser="root";
$dbpwd="";
@mysql_connect("$dbserver","$dbuser",""
@mysql_select_db($dbname);
$data = addslashes(fread(fopen($form_data, "r", filesize($form_data)));
//echo $dbuser;
$result="INSERT INTO binary_data (description,bin_data,filename,filesize,filetype) VALUES ('$form_description','$datanow','$form_data_name','$form_data_size','$form_data_type')";
$query=@mysql_query($result);
//echo $result."<br>";
//echo $query;
$id= mysql_insert_id();
print "<p>This file has the following Database ID: <b>$id</b>";
MYSQL_CLOSE();
}
else
{
?>
<form method="post" action="<?php echo $PHP_SELF; ?>" enctype="multipart/form-data">
File Description:<br>
<input type="text" name="form_description" size="40">
<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000000">
<br>File to upload/store in database:<br>
<input type="file" name="form_data" size="40">
<p><input type="submit" name="submit" value="submit">
</form>
<?php
}
?>
</BODY>
</HTML>
thanks and regards,
Nanban