title: Public and private Media of SonataMediaBundle uploaded in different folders (web and private)
body: <p>I'm using SonataMediaBundle and until now I've been uploading files publicly in the <code>web</code> folder of Symfony. Here is part of my configuration file: </p>
  
  <pre><code>contexts:
      default:  # the default context is mandatory
          providers:
              - sonata.media.provider.dailymotion
              - sonata.media.provider.youtube
              - sonata.media.provider.image
              - sonata.media.provider.file
              - sonata.media.provider.vimeo
  
          formats:
              small: { width: 100 , quality: 70}
              big:   { width: 500 , quality: 70}
      profile_pics:  # the default context is mandatory
          providers: 
              - sonata.media.provider.dailymotion
              - sonata.media.provider.youtube
              - sonata.media.provider.image
              - sonata.media.provider.file
              - sonata.media.provider.vimeo
  
          formats:
              small: { width: 100 , quality: 70}
              big:   { width: 500 , quality: 70}
  
  cdn:
      server:
          path: %cdn_server_path% # http://media.sonata-project.org/
  
  filesystem:
      local:
          directory:  %kernel.root_dir%/../web/uploads/media
          create:     false
  </code></pre>
  
  <p>And in my <code>parameters.yml</code> I have  <code>cdn_server_path: /uploads/media/</code>.</p>
  
  <p>This will upload files in the <code>web/uploads/media/contextname/0001/01/***</code>.</p>
  
  <p>Being in the public folder, these files are visible to everyone. I know I can change this folder somewhere in <code>app/Resources/</code>, but that will make ALL of my files private, which I don't want. By private, I mean that they should be served by a controller, somehow.</p>
  
  <p>How can I separate some files being public and others being private? Is there a way to make a certain context upload files differently than another? Or any other way?</p>
  
  <p>Also, when uploading files to the app/Resources folder, they cannot be previewed since their url becomes <a href="http://website.com/app/Resources/media/profile_pics/0001/01/85e05ab9685b1745af4e64ff98ef91eed6e4ccdf.jpeg" rel="nofollow">http://website.com/app/Resources/media/profile_pics/0001/01/85e05ab9685b1745af4e64ff98ef91eed6e4ccdf.jpeg</a> which is not public, because it's not in the web folder, the only public files that Symfony has. How can this be done?</p>
  
  <p><strong>EDIT</strong>: I've managed to do the uploading part(check the answer below), but the retrieving part is a bit troublesome. I'm still looking for a way to do it.</p>