Jump to content

Archived

This topic is now archived and is closed to further replies.

stephenk

Upload script file size limit

Recommended Posts

I have made a little file upload script for images and was wondering if apache imposes some sort of upload size limit? It seems to be about 1.5mb. The script is for a client to add new pictures to the website, but I'm using GD to resize them, and so I would ideally like to be able to upload 5mb images (from digital camera).

Thanks for any help,
Stephen

Share this post


Link to post
Share on other sites
Generally the default upload file size is 2mb. This can sometimes be changed in your php.ini file (if your host allows it).

try running the phpinfo() on your host. then look for upload_max_filesize

Lite...

Share this post


Link to post
Share on other sites
ah ha!

Thanks very much for that. Im now using .htaccess to force it up to 5M.

Cheers
Stephen

Share this post


Link to post
Share on other sites
mine allowes 50mb

but when using uploa dform i know you gotta put a hidden field and give it a maxfile size allowed, but how do i know how muhc is 1mb if you have to give the file size in k. is there any where i can go that i cna calculate how many k or mb or what = whattever.. so when i want to give one specifict size i know what i'm doing..

Share this post


Link to post
Share on other sites
You can't change upload_max_size on runtime, but you can check the size of an uploaded file. Something like this:

[code]if ($_FILES['file']['size'] >(1024 * 1024)) {
   echo 'File bigger than 1 MB!';
}[/code]

1024 bytes = 1 KB
1024 KB = 1 MB
1024 MB = 1 GB
...

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.