title: Passing arguments to flask.url_for()
body: <p>I'm making a simple website where the user uploads an image, which is then displayed on the page. In get_root:</p>
  
  <pre><code>@app.route('/', methods=['POST', 'GET'])
  def get_root():
      if request.method == 'POST':
          return render_template("webpage2.html", image = upload_file())
      return render_template("webpage2.html")
  </code></pre>
  
  <p>In upload_file:</p>
  
  <pre><code>@app.route('/upload/', methods = ['POST', 'GET'])
  def upload_file():
      if request.method == 'POST':
          if 'fileToUpload' not in request.files:
              flash('No file part')
              return redirect(request.url)
          file = request.files['fileToUpload']
          if file.filename == '':
              flash('No selected file')
              return redirect(request.url)
          if file and allowed_file(file.filename):
              filename = secure_filename(file.filename)
              file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
              return redirect(url_for('uploaded_file', filename=filename))
  </code></pre>
  
  <p>In uploaded_file():</p>
  
  <pre><code>@app.route('/image/', methods = ['POST', 'GET'])
  def uploaded_file(filename):
      return send_from_directory(app.config['UPLOAD_FOLDER'], filename)
  </code></pre>
  
  <p>When I test it out the page loads, but without the image, and I get the following error on the console: </p>
  
  <pre><code>TypeError: uploaded_file() takes exactly 1 argument (0 given)
  </code></pre>
  
  <p>I've tried a number of variations, but this seems to me the main problem: passing the correct parameter to uploaded_file. </p>