Results 1 to 2 of 2

Thread: how to upload above 1MB file using PHP

  1. #1

    Thread Starter
    Fanatic Member vijy's Avatar
    Join Date
    May 2007
    Location
    India
    Posts
    548

    how to upload above 1MB file using PHP

    hai,
    I am trying to upload a file which is 3.4MB(gif file).according to my code i am storing the file in folder named advertisment.If i upload above 1.5MB ,the file get uploaded in the database,but not in the folder.if i did less than that..the file is available..
    i have also cHanged the php.ini file..upload_max_file=8MB,I have used enctype="multipart/form-data"
    this is my code..
    PHP Code:
    <?
    if(isset($_POST['submit']))
    {
    $ext=substr($_FILES["photo"]["name"],-4);
    $category=$_POST['category'];
    $date=date('Y-m-d');
    $sql_check="select * from conadv where category='$category'";
    $query_check=mysql_query($sql_check) or die(mysql_error());
    $num=mysql_num_rows($query_check);
    if($num==0)
    {
    $sql_advertisment="insert into conadv(photo,category,date) values('$ext','$category','$date')";
    $query_advertisment=mysql_query($sql_advertisment) or die(mysql_error());
    $id=mysql_insert_id();
    $filename="conadv".$category.$id.$ext;
    $uploadFile = "../advertisment/".$filename;
    if (copy($_FILES["photo"]["tmp_name"], $uploadFile))
    {
    //header("loaction:viewmain.php");
    }
    }
    else
    {
    $error="Alredy Exists";
    }

    }
    ?>
    kindly help me friends...try to solve this pbm
    Last edited by penagate; Sep 25th, 2007 at 04:30 AM. Reason: Added [php] tags
    Visual Studio.net 2010
    If this post is useful, rate it


  2. #2
    Fanatic Member
    Join Date
    Aug 2003
    Posts
    601

    Re: how to upload above 1MB file using PHP

    your host might not alllow files larger then 1.5mb?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width