5, December 2008

File size uploading issue - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Easy PHP Upload (Moderator: Olaf)
Topic: File size uploading issue
« previous next »
Pages: [1] Print

Author Topic: File size uploading issue  (Read 1612 times)
My name is Bong, James Bong
*
Posts: 11
74 credits
Members referred : 0


« on: Nov 28, 2006, 07:44:40 AM »

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); }
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6486
39748 credits
Members referred : 374


It's time to use PHP5!


« Reply #1 on: Nov 28, 2006, 08:14:37 AM »

do you get an error from the script?


Last blog : Just a better Internet portal provided by Google
My name is Bong, James Bong
*
Posts: 11
74 credits
Members referred : 0


« Reply #2 on: Nov 28, 2006, 08:15:12 AM »

nope :/
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6486
39748 credits
Members referred : 374


It's time to use PHP5!


« Reply #3 on: Nov 28, 2006, 08:18:17 AM »

is the hidden fiield (max file size) before all other form fields?


Last blog : Just a better Internet portal provided by Google
My name is Bong, James Bong
*
Posts: 11
74 credits
Members referred : 0


« Reply #4 on: Nov 28, 2006, 08:37:11 AM »

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>
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6486
39748 credits
Members referred : 374


It's time to use PHP5!


« Reply #5 on: Nov 28, 2006, 09:44:12 AM »

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


Last blog : Just a better Internet portal provided by Google
My name is Bong, James Bong
*
Posts: 11
74 credits
Members referred : 0


« Reply #6 on: Nov 28, 2006, 04:37:11 PM »

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.
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6486
39748 credits
Members referred : 374


It's time to use PHP5!


« Reply #7 on: Nov 28, 2006, 06:14:35 PM »

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()


Last blog : Just a better Internet portal provided by Google
My name is Bong, James Bong
*
Posts: 11
74 credits
Members referred : 0


« Reply #8 on: Nov 29, 2006, 03:55:38 AM »

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..
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6486
39748 credits
Members referred : 374


It's time to use PHP5!


« Reply #9 on: Nov 29, 2006, 09:32:45 AM »

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)


Last blog : Just a better Internet portal provided by Google
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=4965
Tags : php databases hosting php.ini Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Easy PHP Upload (Moderator: Olaf)
Topic: File size uploading issue
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Dec 05, 2008, 05:05:35 AM





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 37.995
Total Topics: 7.685
Total Members: 4.467
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: jschless81

28 Guests, 4 Users online :

10 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2008 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.