...

View Full Version : Upload file problem



eshban
07-09-2005, 12:25 PM
I make a function in PHP which uploads a file to a server. BUt i have a one huge file, its size is 10MB. When i upload it(i have a broadband connection 512 KBPS)
it gives error.

It there any other method in PHP, to uplaod a larger file. Or is there any other soultion.

plz reply
Eshban

chump2877
07-09-2005, 12:45 PM
what do you have the maximum file size set to in your script? Or do you not have it set?

eshban
07-09-2005, 12:47 PM
Hi,

i did n't set any size, php using its default size. How can i fiz this problem

delinear
07-09-2005, 12:52 PM
The only way to fix it is to specify a higher maximum size in your php.ini, you can find it under the "upload_max_filesize" directive.

chump2877
07-09-2005, 12:55 PM
Well I usually ad this line of code to my HTML upload form:


<input type="hidden" name="MAX_FILE_SIZE" value="2000000">

where value is measured in bites...so the max file size here is 2 MB...

I know there is a way, and probably a more secure way (since it's server side, it's harder to be hacked), of setting max file size using PHP, but I never got around to learning that.....I probably should....

anyway, to make your script functional, you can use that HTML code....but eventually I would look into the PHP way of setting max file size, cause its more secure....

maybe I'll look for you and see, if I'm feeling generous... ;)

eshban
07-09-2005, 12:59 PM
I use it also, but still it says, maximum file size exceeds. SO how can i upload a file size of 10 MB.

plz reply
eshban

chump2877
07-09-2005, 01:06 PM
The only way to fix it is to specify a higher maximum size in your php.ini, you can find it under the "upload_max_filesize" directive.

dilinear, if you don;t have access to the php.ini, is there a way to override the remote server's php.ini by uploading your own makeshift php.ini text file to the server, with the change in the directive in the text file.....

just curious.....

if not, it looks like you need to have administrative privileges to your server to change the directive (in the php.ini)...i guess that's the only way

delinear
07-09-2005, 01:08 PM
Like I said above, you have to specify your filesize in php.ini in upload_max_filesize, you might be able to set it via .htaccess, I've never tried but it's probably worth a try if you don't have access to php.ini.

You can find out exactly where the error is being generated, by the way, by echoing the error code $_FILES['userfil'['error'] - if it's a 1 then the php size limit is the problem, if it's a 2 then the html limit is the problem.

You can also check your php size limit by doing a php_info(); function call - look through the info for upload_max_filesize and you will instantly see if that's the issue.

delinear
07-09-2005, 01:10 PM
dilinear, if you don;t have access to the php.ini, is there a way to override the remote server's php.ini by uploading your own makeshift php.ini text file to the server, with the change in the directive in the text file.....


I don't think so unfortunately. I think it's possible to change via .htaccess but only if your host allows it. The reason I say this is because I had to request one of my shared hosts increase my limit from 2MB to 5MB recently and I'm sure they said something about having to make the request because they've restricted the ability to change it via .htaccess :cool:

delinear
07-09-2005, 01:16 PM
eshban, if you're on *nix try creating a unix-formatted .htaccess file with the following code:

php_value upload_max_filesize 50m
and put it in your root directory. If that doesn't work and you don't have access to the php.ini then all I can suggest is either asking your host to increase it for you or finding a new host :o



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum