title: Help improve my file upload method (Pyramid framework)
body: <p>Currently, I am using the following method for uploading files (via HTML form) in Pyramid.</p>
  
  <pre><code>if request.params.get('form.submitted'):
  
      upload_directory = os.getcwd() + '/myapp/static/uploads/'
  
      my_file = request.POST.get('thumbnail')
      saved_file = str(upload_directory) + str(my_file.filename)
  
      perm_file = open(saved_file, 'w')
  
      shutil.copyfileobj(my_file.file, perm_file)
      my_file.file.close()
      perm_file.close()
  </code></pre>
  
  <p>I am just wondering, is this a good way of saving file uploads, are there any security concerns with my method? How else can I improve my method. Thanks.</p>