title: Boto - Uploading file to a specific location on Amazon S3
body: <p>This is the code I'm working from</p>
  
  <pre><code>import sys
  import boto
  import boto.s3
  
  # AWS ACCESS DETAILS
  AWS_ACCESS_KEY_ID = ''
  AWS_SECRET_ACCESS_KEY = ''
  
  bucket_name = AWS_ACCESS_KEY_ID.lower() + '-mah-bucket' conn = boto.connect_s3(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
  bucket = conn.create_bucket(bucket_name, location=boto.s3.connection.Location.DEFAULT)
  uploadfile = sys.argv[1]
  
  print 'Uploading %s to Amazon S3 bucket %s' % \
         (uploadfile, bucket_name)
  
  def percent_cb(complete, total):
      sys.stdout.write('.')
      sys.stdout.flush()
  
  from boto.s3.key import Key
  k = Key(bucket)
  k.key = 'my test file'
  k.set_contents_from_filename(testfile, cb=percent_cb, num_cb=10)
  </code></pre>
  
  <p>On my S3 I have created "directories", like this "bucket/images/holiday". I know these are only virtual directories. </p>
  
  <p>My question is, how can I modify this upload specifically to bucket/images/holiday virtual directory on S3 rather than the bucket root?</p>