Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

56 users online



Limiting foldersize?

Limiting foldersize?

Currently viewing this thread: 1 (0 members and 1 guests)


Dabu

Dabu

Status: Offline!

Limiting foldersize?

I am in the process of creating almost like a webhositng manager script for my friend. I was wodnering is there any way to limit the size of a FOLDER not file but folder in general. So lets say they have a 2mb file and a 26mb file and the limit was 30mb they could only up a 2mb or less file or it would come up with an error.

I know that this is possible by doing it manualy in apache but is there any way to automate it with like php or perl?

Oxy

Oxy

Neverside Newbie
Status: Offline!

Calculate how much 'free' space there is in the directory before the upload. Then when the user attempts to upload a file, check if its larger than the 'free' space and if it is give an error message and don't move it to the directory from your temp directory.

___________________

RAAAH

Phil

Phil

with Mr. Jones
Status: Offline!

You'd have to find the size of the folder and restrict uploading if its too much. The only way to find size of a folder is by recursively finding the size of all files inside it.

___________________

http://www.philbrodeur.com - Expert PHP Development and Tutorials

Motorspin

Motorspin

Neverside Newbie
Status: Offline!

Yep, read a directory, loop through all the files, add the file sizes. When you get that and he tries to upload another file, add that to the filesize that you just made (by looping through) and if it's over the limit, don't upload / save it to disk, just redirect or something.

___________________

Travis Farrell
http://motorspin.com/stuff/images/avasig/m_enterprisesig.gif

Dabu

Dabu

Status: Offline!

ok thanks how do i find the size of a file?

Motorspin

Motorspin

Neverside Newbie
Status: Offline!

filesize('file.ext');

___________________

Travis Farrell
http://motorspin.com/stuff/images/avasig/m_enterprisesig.gif

Dabu

Dabu

Status: Offline!

thanks a million

Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0068 seconds.