I have a Python web application that runs locally in a web browser for interface convenience, processes files that a user selects, and saves processed data. I need to add the feature that creates a new subdirectory in the same folder where the file was selected (i.e., if the file is path/fname.txt, I need to create path/fname/ where I can put processed data). How do I access this path to the file?
In other projects I have asked for the path separately, but that's clunky and I'd rather not make the user do this extraneous step for each file.
@app.route('/getthefile', methods=['POST'])
def getthefile():
    file = request.files['myfile']
    filename = secure_filename(file.filename)
    new_path = os.path.abspath(filename)
    # gives me the wrong path
 
     
    