hi ,
I have crerated a mysql database to store images , mp3 , video files..etc. In
my first stage i stored images as jpg , gif .
But when i try to store little but huge gif files it wont store . I used the
script as follows to upload images,
<html>
<head>
<title>Upload File To MySQL Database</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.box {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
border: 1px solid #000000;
}
-->
</style>
</head>
<body>
<?
if(isset($_POST['upload']))
{
$fileName = $_FILES['userfile']['name'];
$tmpName = $_FILES['userfile']['tmp_name'];
$fileType = $_FILES['userfile']['type'];
$fileSize = $_FILES['userfile']['size'];
$fp = fopen($tmpName, 'r');
$content = fread($fp, $fileSize);
$content = addslashes($content);
fclose($fp);
if(!get_magic_quotes_gpc())
{
$fileName = addslashes($fileName);
}
include 'library/config.php';
include 'library/opendb.php';
$query = "INSERT INTO upload (name, type, size, content ) ".
"VALUES ('$fileName', '$fileType','$fileSize',
'$content')";
mysql_query($query) or die('Error, query failed');
include 'library/closedb.php';
echo "<br>File $fileName uploaded<br>";
}
?>
<form action="" method="post" enctype="multipart/form-data" name="uploadform">
<table width="350" border="0" cellpadding="1" cellspacing="1" class="box">
<tr>
<td width="246"><input type="hidden" name="MAX_FILE_SIZE"
value="2000000"><input name="userfile" type="file" class="box" id="userfile">
</td>
<td width="80"><input name="upload" type="submit" class="box" id="upload"
value=" Upload "></td>
</tr>
</table>
</form>
</body>
</html>
56Kb , 75 Kb files are accept to store , but more that 1 MB we cant upload. It
wont give any error messages . But that particular data wont displayed.
so , this is a big problem for me . i couldnt sorted out yet . I used mysqlcc
and sqlYOG as well to upload images ( contents ).
in like this situations how can we work with mp3 and such huge files ????
please . help me ............very very urgent
Thanx in advance,
Kane.
---------------------------------
Yahoo! Music Unlimited - Access over 1 million songs. Try it free.