I cannot upload more than 1mb photo into databases.
i`m using wampserver.when it is below one 1mb it is uploaded. your help will be appreciated.
Down is the code i used to upload photo.

upload.php
<form action="addphoto.php" method="POST" enctype="multipart/form-data">
<table cellpadding=0 cellsapcing=0 border=0 align=center width=450 height=50 bgcolor=gray>
<tr><td><p><b><font color=blue>UPLOAD YOUR PROFILE PHOTO</font></b></p>
<p><input type="hidden" name="MAX_FILE_SIZE" value="102400"></br><input type="hidden" name="user" value="<?php echo $user;?>"></br>
<input type="hidden" name="userid" value="<?php echo $id;?>">
Image :<input type="file" name="file"><br/>
<center><input type="submit" value="Upload" name="submit"></center></p></td></tr>
</table>
</form>


addphoto.php


<?php
if ($_POST) {
$user=$_POST;
$id=$_POST;


if ($_POST >= $_FILES) {
//print_r($_FILES);
mysql_connect("localhost", "root", "650715") or die(mysql_error());
mysql_select_db("register");
$photo = addslashes(fread(fopen($_FILES, "r"),
$_FILES));
$query = sprintf("INSERT INTO image(image, filetype,user,userid) VALUES
('%s', '%s','$user','$id')", $photo, $_FILES);
if (mysql_query($query)) {
echo "Your files is successfully stored in database";


} else {
echo"Error detected while trying to upload your photo<br> Try again please";
}
} else {
echo"The file is bigger than the allowed size please resize";
}
}


?>

?????
I don't get your problem. You say you get an error, when you upload more than 1MB and write in your code

if ($_POST['MAX_FILE_SIZE'] >= $_FILES['file']['size']) {

By the way: hidden textboxes are bad style anyway. Why don't you just define the maximal size directly in addphoto.php?

It will be todo with your max upload limit on the server you are using aswell. Most will not let u alter this unless u own the server.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.