NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: Alberto on February 01, 2009, 04:16:30 AM

Title: Storing Images
Post by: Alberto on February 01, 2009, 04:16:30 AM
Hi,
My project will have a lot of users, each user will upload a photo.
Each user will have many clientes and products, each one with its own photo.
Suppousing there will be thouthands...
Which is the best way to store the images in the server?
I think there are two ways:
1- Store them "as is", as files distributed in folders. Is there any limit in the folder quantity in the OS or the hard disk?
2- Store them in blob fields. The problem with this approach is that I cant see the images in a browse or a form if I dont make it files before, then I need a folder for each user, client, product, etc and I am close to the other option.
Any Idea of how to proceed?

Thanks
Alberto
Title: Re: Storing Images
Post by: Bruce on February 01, 2009, 08:02:36 AM
How many users is "a lot" ?
Folders on disk can handle > 100 000 files. But it slows the machine down to read a folder with that many files.

Cheers
Bruce
Title: Re: Storing Images
Post by: Alberto on February 02, 2009, 06:42:09 AM
If I succed... millons <g>
Title: Re: Storing Images
Post by: charl99 on February 03, 2009, 05:06:43 AM
Alberto,

In my previous posting you saw I rename and copy the file to a different folder.

What I actually do is I have a file with ImageNo (Unique key), so the uploaded file is copied to that ImageNo.Ext so when you want to download the file Windows automatically opens the right 'Viewer' thing to open the file, PDFs, JPGs, CSVs, DOCs, XLSs, I have not found a file type that does not work.

I also store the original file name and that is what I display on the Browse.  As for when you get to too many files like millions, maybe copy ImageNo's 1-49,999 in subfolder \1, Images 50,000 - 99,999 in subfolder \50,000, etc.

Cheers
Charl
Title: Re: Storing Images
Post by: Alberto on February 03, 2009, 06:06:27 AM
Charl,

And what happend when 2 users are uploading the same file (same name)?

Regards
Alberto
Title: Re: Storing Images
Post by: charl99 on February 03, 2009, 07:15:45 AM
Alberto,

What's the odds of that happening at exactly the same time? 

Remember it only uploads once you press the 'Save' Button and then the file gets copied, uniquely, somewhere else and deleted right after that.  The ImageNo autoincrement uniquely any way.

I guess you can check if the file name is there and then maybe retry the form, but again, what's the odds?

Cheers
Charl
Title: Re: Storing Images
Post by: Bruce on February 04, 2009, 06:44:03 AM
if you have millions of files then you'll need a strategy for storing them.
probably a big SQL database, and a blob field in that case.

neither TPS, not the Windows directory, will handle millions of images.

Cheers
Bruce