Page 3 of 5

Posted: Tue Mar 02, 2004 10:49 pm
by mikegotnaild
yep

Posted: Tue Mar 02, 2004 10:52 pm
by mikegotnaild
do i need to put one in the upload folder too?

Posted: Tue Mar 02, 2004 10:58 pm
by markl999
Nope, should only need it in the dir where the form is, and possible the dir where the file that does the move_uploaded_file stuff is.
Your host may not allow you to override the upload size. One other solution is to remove the <INPUT TYPE="hidden" name="MAX_FILE_SIZE" lines from the form and just use your hosts 8M limit *shrug*

Posted: Tue Mar 02, 2004 11:01 pm
by mikegotnaild
So how come i can put things that are less than 2 but not what my php.ini (8mb) is set at?

Posted: Tue Mar 02, 2004 11:05 pm
by markl999
Your <INPUT TYPE="hidden" name="MAX_FILE_SIZE" .. appear to be overriding it somehow. I didn't think putting 2 of them in the same form would work, and it doesn't :o So you may have to leave the hidden fields out and handle the allowed sizes in code using the size property of the $_FILES array.
Eg if($_FILES['mp3file']['size'] > 6000000){ ... } etc..same for the image file

Posted: Tue Mar 02, 2004 11:10 pm
by mikegotnaild
I could change my php.ini to say 6 mb... So would i still have to do that if statement if i changed my phpini to 6mb upload max and removed the hidden fields?

Posted: Tue Mar 02, 2004 11:16 pm
by markl999
Nope, wouldn't need those fields, that would allow 6M images and mp3 files. As it stands, if you remove those hidden fields it should allow 8M images and mp3 files.

Posted: Tue Mar 02, 2004 11:17 pm
by mikegotnaild
i dont think im understanding this clearly.. So even if i do what i just stated the mp3 files will still have to be under 2 mb?

Posted: Tue Mar 02, 2004 11:21 pm
by markl999
No, basically, if you remove those 2 hidden fields then both images and mp3's will be limited to 8M (the value in your php.ini).

Just try removing them first and see if you can upload an mp3 that's larger than 2M, it should let you now.

Posted: Tue Mar 02, 2004 11:23 pm
by mikegotnaild
ooooo So what would my code look like if i did that if statement?

Posted: Tue Mar 02, 2004 11:28 pm
by markl999
Same as the form is now, just remove those 2 hidden MAX_UPLOAD fields.

Posted: Tue Mar 02, 2004 11:30 pm
by mikegotnaild
i mean the upload script

Posted: Tue Mar 02, 2004 11:36 pm
by markl999
oh, you mean if you want to use the 8M size limit but set a limit in the code?
Then you could just do something like :
$imglimit = 200000; //200K
$mp3limit = 6000000; //6M
if($_FILES['imagefile']['size'] > $imglimit){
echo 'Image is too big'; exit;
}
if($_FILES['mp3file']['size'] > $mp3limit){
echo 'Mp3 is too big'; exit;
}

Just put that anywhere before all the file_exists stuff.

Posted: Tue Mar 02, 2004 11:42 pm
by mikegotnaild
Thanks once again Mark

Posted: Tue Mar 02, 2004 11:55 pm
by mikegotnaild
i still get that error i originally got...