unable to upload files larger than 1MB

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ssharifi
    New Member
    • Apr 2010
    • 11

    #1

    unable to upload files larger than 1MB

    Hi,I have problem in uploading files larger than 1MB!!

    I changed the php.ini setting to this:
    memory_limit = 32M ---> 320M
    post_max_size = 16M-->160M
    upload_max_file size = 32M--> 320M
    with the initial setting i could upload files smaller than 1M and for larger till 6M it echoed query error(means it was unable to insert the file into database) and for larger than 6M it echoed fatal error:
    Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 24117249 bytes) in C:\xampp\htdocs \func\publicati on.php on line 50
    now with the changed numbers for all sizes i have query error
    here is the query if needed
    Code:
    $upload = "INSERT INTO upload(name, size,type,content) ".
    "VALUES ('$fileName', '$fileSize', '$fileType','$content')";
    mysql_query($upload) or die('Unable to upload, query failed');
    I roled back my php.ini settings to the initial and instead i made a .htaccess file in the root directory(so that in future i can use it in server) and added these:
    AddHandler application/x-httpd-php .php
    php_value post_max_size 200M
    php_value upload_max_file size 200M
    php_value memory_limit 300M
    php_value output_bufferin g on
    php_value max_execution_t ime 259200
    php_value max_input_time 259200
    php_value session.cookie_ lifetime 0
    php_value session.gc_maxl ifetime 259200
    php_value default_socket_ timeout 259200
    in this way when i upload files in a directory, i can upload up to 20MB but if i want upload my files in db with blob var,i can only upload to the 1MB range,what should i do if i want to upload a larg file in my database?
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    You should be utilizing the mysql_error() function to obtain information on the error.

    Code:
    mysql_query($upload) or die(mysql_error());

    Comment

    • ssharifi
      New Member
      • Apr 2010
      • 11

      #3
      hi,i chcked,the error is :MySQL server has gone away
      i searched about it,some has sayed that changing the global max_allowed_pac ket might solve the problem,but i didnt find this parameter in php.ini or elsewhere,what should i do then plz?
      and i have my second question that consdering these problems and also database becoming so heavy,which method is better for uploading in a page that about 100 pdf articles are uploaded in a year(each can be up to 20M) and i should keep all so that visitors can download it ?up to now i chose to upload in blob var of db but i am affraid of my db being so heavy and also this problem that i cant upload large files,

      Comment

      Working...