Home>
I want to open another URL in a new tab

I made a process that jumps to another URL after the Upload button of the image is pressed.
I was able to jump to another URL, but how can I skip it in a new tab or window?

Applicable source code

The jump destination URL is appropriate.

#-coding utf8--
from bottle import route, run, template, request, static_file, url, get, post, response, error, abort, redirect, os, redirect, HTTPResponse
from time import strftime
@get ('/ upload')
def upload ():
    return '' '
        <form action = "/ upload" method = "post" enctype = "multipart/form-data">
            <input type = "submit" value = "Upload"></br>
            <input type = "file" name = "upload"></br>
        </form>
    '' '
@route ('/ upload', method = 'POST')
def do_upload (): When #upload button is pressed
    r = HTTPResponse (status = 302)
    r.set_header ('Location', 'http: // localhost: 8080/top') #Redirect destination url
    return r
run (host = 'localhost', port = 8080)
  • Answer # 1

    Is this expected behavior by addingtarget = _blankto the prepared form tag?

    @get ('/ upload')
    def upload ():
        return '' '
            <form action = "/ upload" method = "post" target = "_ blank" enctype = "multipart/form-data">
                <input type = "submit" value = "Upload"></br>
                <input type = "file" name = "upload"></br>
            </form>
        '' '