File Attachment - Multiple Subdirectories in /files folder

Do not post support requests, bug reports or feature requests. Discuss phpBB here. Non-phpBB related discussion goes in General Discussion!
Get Involved
Post Reply
Connert Media
Registered User
Posts: 6
Joined: Wed Oct 20, 2010 12:13 am

File Attachment - Multiple Subdirectories in /files folder

Post by Connert Media » Sat Apr 02, 2011 4:42 pm

Is there a MOD, setting or technique that I can use to spread my attachment files into multiple subdirectories much like WordPress stores their media files by month. In otherwords, rather then having thousands of attachment files located in /files, I could store them in a serious of subfolders such as:

/files/2011/04
/files/2011/05

I know that I can change the current location by changing a preference in the Admin Panel, but I would also like all the previous locations still available.

Thoughts? Suggestions?

User avatar
Sam
Former Team Member
Posts: 2082
Joined: Thu Jan 22, 2009 3:59 am
Location: Sacramento, CA
Name: Sam Thompson
Contact:

Re: File Attachment - Multiple Subdirectories in /files fold

Post by Sam » Sat Apr 02, 2011 6:07 pm

Files are stored extensionless with their name comprised of {userid}_{some hash}. This makes them useless to access as they are because the web server will be unable to serve it properly, plus all direct access to files/ cut off via directory level configuration anyway. Additionally, attachments respect permissions, something that blogging software does not have to protect against (just by it's nature, all files are assumed public anyway), so all files must be accessed through file.php inside phpBB.

Connert Media
Registered User
Posts: 6
Joined: Wed Oct 20, 2010 12:13 am

Re: File Attachment - Multiple Subdirectories in /files fold

Post by Connert Media » Sat Apr 02, 2011 8:05 pm

Yes, I understand the security feature, but the problem is slightly different.

Some hosting services and now limiting the number of files per directory based upon limitations of their backup software. One of the biggest is Godaddy which is now dropping folks who have over 1024 file per directory. It's probably time to find another hosting service.

Reference: http://community.godaddy.com/help/artic ... ?locale=en

WebTechGlobal
Registered User
Posts: 23
Joined: Thu Jul 15, 2010 8:17 pm

Re: File Attachment - Multiple Subdirectories in /files fold

Post by WebTechGlobal » Tue Jul 19, 2011 1:11 pm

I didn't know hosting was doing that.

GoDaddy are very strict but they also charge the extra for what should be a better hosting right?

Personally I go with a cheaper hosting who provides a good enough service. There is nothing wrong with 1% downtime in a year and you don't need a flashy control panel all the time.

I provide hosting myself, WebTechGlobal but I'm with Heart Internet. Customer service there always impresses me and their downtime is the 1% I'm on about. I don't have silly restrictions, they have MU installation from control panel.

User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Re: File Attachment - Multiple Subdirectories in /files fold

Post by drathbun » Tue Jul 19, 2011 1:20 pm

I've been experimenting with a hash tag that would be used to spread attachments out over a folder structure but never finished it. At one point I was given information that implied that it's more efficient to traverse a directory tree with 100 files in 16 folders than 1600 files in a single folder. My idea was to take the attached file name and pass it through a hashing algorithm, then take the first (or last or middle) character from the hash and use it to determine which sub-folder the attachment would be stored in. The directory structure would be:

Code: Select all

files\0\
files\1\
files\2\
files\3\
...
files\d\
files\e\
files\f\
One of the reasons I never finished it was I was never really sure if it would be more efficient, or just be... different. :) I never heard of a host placing limits on the number of files in a folder. However, I have run into the 1024 file limit while helping a client move her site. I had to capture the first 1024 files, move them, delete them from the source system, and try again until I got everything. Not sure if that's a linux issue or where the limitation was coming from.
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image

User avatar
Lumpy Burgertushie
Registered User
Posts: 65310
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: File Attachment - Multiple Subdirectories in /files fold

Post by Lumpy Burgertushie » Tue Jul 19, 2011 2:10 pm

the only time I have seen that was a limitation in the ftp program I was using . for whatever reason it could not show them all at once. if you actually put the file name or in my case folder name, into the path box, it would then show them to you from that file forwards.

weird,

robert
I am available for custom work on a donation basis. Please send me a PM with your needs.

Premium phpBB 3.2 Styles by PlanetStyles.net

OK, so what's the speed of dark?

User avatar
bantu
3.0 Release Manager
3.0 Release Manager
Posts: 2523
Joined: Mon Jul 10, 2006 9:58 pm
Name: Andreas Fischer

Re: File Attachment - Multiple Subdirectories in /files fold

Post by bantu » Tue Jul 19, 2011 2:12 pm

Powered by Coffee

Connert Media
Registered User
Posts: 6
Joined: Wed Oct 20, 2010 12:13 am

Re: File Attachment - Multiple Subdirectories in /files fold

Post by Connert Media » Tue Jul 19, 2011 2:53 pm

GoDaddy.com still imposes the 1024 file limit on many of their hosting accounts:
http://community.godaddy.com/help/artic ... ?locale=en
... so a subdirectory system still would be an asset in many of my client's cases.

I still like the idea of how WordPress stores their media files by month:
/files/2011/07
/files/2011/08
/files/2011/09
etc.

Anyway... I'm still hoping for sometype of solution. Probably the best is moving away from Godaddy.

User avatar
drathbun
Former Team Member
Posts: 12204
Joined: Thu Jun 06, 2002 3:51 pm
Location: TOPICS_TABLE
Contact:

Re: File Attachment - Multiple Subdirectories in /files fold

Post by drathbun » Wed Jul 20, 2011 2:17 pm

bantu wrote:See http://area51.phpbb.com/phpBB/viewtopic ... 34#p211434
As a workaround we could strip off the first character of the physical filename and ship 16 subfolders in files in our packages, but that would only move the problem to another limit (~16 * 2000 instead of ~2000).
That's basically what I was suggesting. Create the sub-folders as part of the install, knowing that you would be using them. Yes, it's still a hard limit on the number of files, but it's an order of magnitude higher than it is today.
I blog about phpBB: phpBBDoctor blog
Still using phpbb2? So am I! Click below for details
Image

Post Reply

Return to “phpBB Discussion”

Who is online

Users browsing this forum: Exabot [Bot], Mathieu M. and 22 guests