title: What is the best way to upload and store pictures on the site?
body: <p>I have no idea how the big websites save the pictures on their servers. Could any one tell me how do they save the pictures that are uploaded by the users in their database?</p>
  
  <p>I was thinking, maybe they would just save the file(the picture) in some path and just save that path in the databse is that right?</p>
  
  <p>But I want to do it this way. Is this right? For example, a website named <code>www.photos.com</code>.  When a user uploads a picture I would create a folder of the user name and save those pictures in that folder.</p>
  
  <p>I believe we can create a directory using <code>php file concepts</code>.  So when a new user uploads his picture or file, I want to create a directory with his name.</p>
  
  <p>Example: if user name is john, I would create a directory like this on photos.com <code>www.photos.com/john/</code> and then save all his pictures to this directory when he uploads a picture.  Is this the right way to do this?</p>
  
  <p>I have no one here that has good knowledge of saving the files to servers so please let me know how to do this? I want to do it the correct and secure way.</p>