By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,940 Members | 1,328 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,940 IT Pros & Developers. It's quick & easy.

unable to upload files larger than 1MB

P: 11
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_filesize = 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\publication.php on line 50
now with the changed numbers for all sizes i have query error
here is the query if needed
Expand|Select|Wrap|Line Numbers
  1. $upload = "INSERT INTO upload(name, size,type,content) ".
  2. "VALUES ('$fileName', '$fileSize', '$fileType','$content')";
  3. mysql_query($upload) or die('Unable to upload, query failed');
  4.  
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_filesize 200M
php_value memory_limit 300M
php_value output_buffering on
php_value max_execution_time 259200
php_value max_input_time 259200
php_value session.cookie_lifetime 0
php_value session.gc_maxlifetime 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?
Apr 24 '10 #1
Share this Question
Share on Google+
2 Replies


Markus
Expert 5K+
P: 6,050
You should be utilizing the mysql_error() function to obtain information on the error.

Expand|Select|Wrap|Line Numbers
  1. mysql_query($upload) or die(mysql_error());
Apr 24 '10 #2

P: 11
hi,i chcked,the error is :MySQL server has gone away
i searched about it,some has sayed that changing the global max_allowed_packet 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,
Apr 25 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.