0

I'm in my pset7, similarities. Python part of compare works without any issues. But when i check web page with flask, when i click submit, it shows a 400 error. I could not find where the error is.

Attached the index file. Thanks.

<div class="col">
    <form action="/compare" enctype="multipart/form-data" method="post">
        <input type="file" id="file1">
        <br>
        <input type="file" id="file2">
        <br>
         <input type="radio" name="algorithm" value="lines" checked> Compare lines<br>
         <input type="radio" name="algorithm" value="sentences"> Compare sentences<br>
         <input type="radio" name="algorithm" value="substrings"> Compare substrings<br>
         <input type="number" min="1" name="length"> Enter the length of substring<br>

         <button type="submit"> Compare </button><br>

    </form>
</div>
2
  • Does it tell you what error it is? Does the terminal (where you see the flask output) give you more information?
    – curiouskiwi
    Aug 11 '19 at 0:48
  • in web page, i get 400 bad request. The browser (or proxy) sent a request that this server could not understand. In flask terminal, i get [11/Aug/2019 04:47:54] "POST /compare HTTP/1.0" 400 - Aug 11 '19 at 4:48
1

The compare function is expecting that your two input files must have a name of file1 and file2. Not an id.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .