I am trying to produce a website by which I have to store a couple of user submitted files (like some profile images, some xml files etc).

What exactly is the easiest method to store individuals files?

Presently, I am developing a new directory around the server for each new user registered and storing the files for every user within their particular directory but someone explained it isn't the easiest way.

So, how do you store individuals files? Whether I produce a common directory &lifier title the files according to the consumer-id or something like that associated with the consumer OR keep developing a new directory for each user??

A workable solution will rely on your needs, e.g. the number of customers are you currently expecting. A 1-directory-per-user solution might hit some filesystem restrictions soon (for ext3, the max quantity of subdirectories in a single directory is bound to 32000).

One-file-per-user ought to be suitable for a lengthy while (see: How many files in a directory is too many?).

Finally, in case your userbase develops you could utilize a set quantity of shards (e.g. in line with the userid) to limit both the amount of sites and the amount of files per directory (for example with this, see how git stores its objects in loose format).

Well you've got a couple of options.

  1. You are able to store them as files around the file system, outdoors the net root.
  2. You are able to store them as binary data inside a standard RMDBS like MySQL.
  3. Use a "NoSQL" database like CouchDB or Redis that are focused on storing documents.

The easiest way will rely on the application, time-frame, as well as your experience. Option 1 would most likely function as the simplest. Option 2 would most likely function as the most flexible. Option 3 would probably be the very best carrying out whether it meets the requirements of your documents.