How to store images in your filesystem
Just split your userid from behind. e.g. UserID = 6435624 Path = /images/24/56/6435624 As for the backup you could use MySQL Replication and backup the slave database to avoid problems (e.g. locks) while backuping.