TangentIdea Posted December 12, 2004 Posted December 12, 2004 Okay, I'm having a major headache over this. I'm trying to insert MP3 files into a mySQL database, but I keep coming across an error of one kind or another. First it was a timeout, now it's filesize. I managed to use the ini_set command to successfully reset the max_execution_time var, but it's not working on the upload_max_filesize one. Here's the code... >$setmaxexectimeresult = ini_set(max_execution_time,600); $uploadsizeresult = ini_set(upload_max_filesize,20240); //20 megabytes and then later on... >echo "[" . $setmaxexectimeresult . "] [" . $uploadsizeresult . "]"; ...which returns... ><!--set result: [30] []--> What's the deal? In the second pair of brackets, it should have a "2M" or something like that, to show that it was successfully reset. Aaand, it doesn't. I'm probably just missing something stupid -- any idea what? Quote
TangentIdea Posted December 12, 2004 Author Posted December 12, 2004 Okay, update: I discovered that ha, yes, I can set that in .htaccess, and apparently I can't within a script. Duh. Okay. Got that working. Now, it says that my problem's with the MAX_FILE_SIZE in the HTML code. Here's what I have: ><input type="hidden" name="MAX_FILE_SIZE" value="20M"><input type="file" name="media" id="media"> Hmm... what's wrong? Quote
TCH-RobertM Posted December 12, 2004 Posted December 12, 2004 One of the quick searches I just did references the following, Note that MAX_FILE_SIZE must be set to the maximum file size that you will allow users to upload. Also note that PHP's configuration limits this to 2 megs - no file greater than that may be uploaded with PHP I am sure there is a work around for this I am just not sure if this is your problem or not.. have you tried uploading files less than 2 meg ? Quote
TangentIdea Posted December 12, 2004 Author Posted December 12, 2004 Okay, now I'm feeling really stupid. I've been stumped on this for weeks, and I'm just now figuring it all out... sigh. Okay, I decided to get rid of the MAX_FILE_SIZE field. Not needed. So, I come across another error: >Got a packet bigger than 'max_allowed_packet' From what I understood from PHP.net, this is a message generated by MySQL. Now what? How do I change this without having admin access? Quote
TangentIdea Posted December 12, 2004 Author Posted December 12, 2004 I am sure there is a work around for this I am just not sure if this is your problem or not.. have you tried uploading files less than 2 meg ? Yeah, I've tested it with smaller files and it works fine. Quote
TCH-RobertM Posted December 12, 2004 Posted December 12, 2004 if you put the following code on a page and upload it to your server and run it you will see that the Max file size for upload using php is set to upload_max_filesize 2M 2M ><?php phpinfo(); ?> what makes you think that the error message your seeing is from MySQL ? did you print out the mysql_error() ? Quote
TCH-RobertM Posted December 12, 2004 Posted December 12, 2004 Also did you try adding this into your htaccess file: php_value upload_max_filesize 20M Quote
TangentIdea Posted December 12, 2004 Author Posted December 12, 2004 if you put the following code on a page and upload it to your server and run it you will see that the Max file size for upload using php is set to upload_max_filesize 2M 2M ><?php phpinfo(); ?> what makes you think that the error message your seeing is from MySQL ? Yes, I know that the PHP max_upload_size is 2M by default. I was trying to change that. I don't know for certain that it's from mySQL; it's just a hunch, from what I know from mysql.com and php.net. Quote
borfast Posted December 14, 2004 Posted December 14, 2004 rmulhern, 2MB is PHP default and the value used here on TCH's servers, it's not the maximum PHP can handle. As Tangentidea said, you can change that setting in .htaccess Tnagentidea, as for your problem with MySQL, the MySQL manual says: A communication packet is a single SQL statement sent to the MySQL server or a single row that is sent to the client. In MySQL 3.23, the largest possible packet is 16MB, due to limits in the client/server protocol. In MySQL 4.0.1 and up, the limit is 1GB. When a MySQL client or the mysqld server receives a packet bigger than max_allowed_packet bytes, it issues a Packet too large error and closes the connection. [...] It also says you can change that configuration option but you need to do so through MySQL's console or by changing it's configuration file. I don't think there's other way to do it and since we don't have access to any of those in a shared server environment, I'd say we're out of luck Quote
TangentIdea Posted December 14, 2004 Author Posted December 14, 2004 Aaak. Okay, any ideas for workarounds? Quote
TCH-RobertM Posted December 15, 2004 Posted December 15, 2004 TCH-Raul thanks for the information on this. TangentIdea , to get around this issue how about just add a link into the MySql Database referencing a file located in a folder ? might be a way around trying to load an entire BLOB into the database. Quote
borfast Posted December 15, 2004 Posted December 15, 2004 Yes, I agree. I forgot to mention that! This is a big topic of debate. My personal opinion is that placing the files outside the database is a better strategy, since it places less load on the database server, among some other reasons. Besides, in your case, as rmulhern said, it would be a way to get around this issue Quote
TCH-RobertM Posted December 15, 2004 Posted December 15, 2004 Teamwork always a great thing......... Rock Sign Quote
TangentIdea Posted December 16, 2004 Author Posted December 16, 2004 Yeah, that was plan B. I thought it might be easier for content maintenance to keep them in the database. That way, when I delete a record, it deletes the whole thing... but doing it with files should work fine. I'm just lazy. Quote
borfast Posted December 16, 2004 Posted December 16, 2004 Yes, it's easier, but in the long run, I think (actually, I know; been there, done that...) that method brings more problems Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.