Sublime directory Surf the web anonymous Pagerank Monitor


File size uploading issue

aegis
Tue 28 November 2006, 07:44 am GMT +0200
Ok for some reason this wont upload an mp3 to my server past a certain file size. If i put an mp3 6mb or lower it works fine but above that it wont work and it gives me no error message. I had this same problem before because my server's something.ini file didnt allow a remote upload of that size and it gave me an error message saying it was too big. But I got that .ini file fixed so it should work. Now it just doesnt give me an error message or anything. It just doesnt upload. here's my code if you wanna take a look.

Code:
<?php

ini_set
("post_max_size""128M");
ini_set("upload_max_filesize""128M");

?>


<?php
include ("upload_class.php"); //classes is the map where the class file is stored (one above the root)

$max_size 1024*500000// the max. size for uploading

$my_upload = new file_upload;
$my_upload2 = new file_upload;

$my_upload->upload_dir $_SERVER['DOCUMENT_ROOT']."/metal/";
$my_upload2->upload_dir $_SERVER['DOCUMENT_ROOT']."/band_images/";

$my_upload->extensions = array(".mp3"); // specify the allowed extensions here
$my_upload2->extensions = array(".jpg"); // specify the allowed extensions here

// $my_upload->extensions = "de"; // use this to switch the messages into an other language (translate first!!!)
$my_upload->max_length_filename 100// change this value to fit your field length in your database (standard 100)
$my_upload->rename_file true;

$my_upload2->max_length_filename 100// change this value to fit your field length in your database (standard 100)
$my_upload2->rename_file true;

if(isset(
$_POST['Submit'])) {
$my_upload->the_temp_file $_FILES['upload']['tmp_name'];
$my_upload->the_file $_FILES['upload']['name'];
$my_upload->http_error $_FILES['upload']['error'];
$my_upload->replace = (isset($_POST['replace'])) ? $_POST['replace'] : "y"// because only a checked checkboxes is true
$my_upload->do_filename_check = (isset($_POST['check'])) ? $_POST['check'] : "n"// use this boolean to check for a valid filename
$new_name = (isset($_POST['name'])) ? $_POST['name'] : "";
if ($my_upload->upload($new_name)) { // new name is an additional filename information, use this to rename the uploaded file
$full_path $my_upload->upload_dir.$my_upload->file_copy;
$info $my_upload->get_uploaded_file_info($full_path); }
// ... or do something like insert the filename to the database

$my_upload2->the_temp_file $_FILES['upload2']['tmp_name'];
$my_upload2->the_file $_FILES['upload2']['name'];
$my_upload2->http_error $_FILES['upload2']['error'];
$my_upload2->replace = (isset($_POST['replace'])) ? $_POST['replace'] : "y"// because only a checked checkboxes is true
$my_upload2->do_filename_check = (isset($_POST['check'])) ? $_POST['check'] : "n"// use this boolean to check for a valid filename
$new_name2 = (isset($_POST['name'])) ? $_POST['name'] : "";
if ($my_upload2->upload($new_name2)) { // new name is an additional filename information, use this to rename the uploaded file
$full_path $my_upload2->upload_dir.$my_upload2->file_copy;
$info $my_upload2->get_uploaded_file_info($full_path); }

olaf
Tue 28 November 2006, 08:14 am GMT +0200
do you get an error from the script?

aegis
Tue 28 November 2006, 08:15 am GMT +0200
nope :/

olaf
Tue 28 November 2006, 08:18 am GMT +0200
is the hidden fiield (max file size) before all other form fields?

aegis
Tue 28 November 2006, 08:37 am GMT +0200
yep here's the form

Code:
<h2>Band of the Week Upload</h2>
<form name="form1" enctype="multipart/form-data" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
  <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_size?>"><br>
 
  <p><b>Band:</b><br />

  <input type="text" name="name">
 
  <p><b>Song:</b><br />

  <input type="text" name="song" />
 
  <p><b>Country:</b><br />

  <input type="text" name="country" />
 
  <p><b>Band Link:</b>
  <br />
  <input type="text" name="link" value="http://"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://www.metal-archives.com" target="new">Metal Archives</a> <br />
  Dont forget the http:// !
 
  <p><b>Pic:</b><br />
  <input type="file" name="upload2" size="30"><br clear="all">
 
  <p><b>mp3:</b><br />
  <input type="file" name="upload" size="30"><br clear="all">
 
  <p>
<input type="submit" name="Submit" value="Submit" />
</form>

<br clear="all">
<p><?php echo $my_upload->show_error_string(); ?></p>
<?php if (isset($info)) echo "<blockquote>".nl2br($info)."</blockquote>

olaf
Tue 28 November 2006, 09:44 am GMT +0200
I see the problem:

upload_max_filesize "2M" PHP_INI_SYSTEM|PHP_INI_PERDIR

will say you need to add the value to the php.ini file or (if supported) in a .htaccess file

aegis
Tue 28 November 2006, 04:37 pm GMT +0200
ok well what do you mean? I'll have to talk to my web hosting to change the file so what should i tell them? I can upload files bigger than 2M right now though. it goes to about 6M.

olaf
Tue 28 November 2006, 06:14 pm GMT +0200
ok well what do you mean? I'll have to talk to my web hosting to change the file so what should i tell them? I can upload files bigger than 2M right now though. it goes to about 6M.
check your config with phpinfo()

aegis
Wed 29 November 2006, 03:55 am GMT +0200
oh actually i just noticed the error log file. it says this. [27-Nov-2006 23:21:01] PHP Warning:  POST Content-Length of 9537535 bytes exceeds the limit of 8388608 bytes in Unknown on line 0

so how do i get it bigger than that? they said they set my php.ini max upload to 32M a while ago..

olaf
Wed 29 November 2006, 09:32 am GMT +0200
the post_max-size need to be set inside the php.ini or .htaccess

I think that this directive is set lower then your upload_max_filesize (what actually makes no sense)

Archive for SMF v1.00 by N.P. Valid XHTML 1.0 Transitional