文件未被浏览器发送

时间:2014-02-23 14:13:34

标签: http post file-upload

我对以下网页感到困惑:

<!DOCTYPE html>
<html>
    <head>
        <title>workbench: Home</title>
        <link rel="stylesheet" type="text/css" href="/styles/style.css">
    <meta charset="UTF-8">
    </head>
    <body>
        <a href="/"><img class="logo" src="/images/cats-muvva.gif" alt="Cats-Muvva Logo" /></a>
        <header>
            <h1>Router at workbench</h1>
        </header>
        <menu>
            <p><a href="/log.html">Log Out</a></p>
        </menu>
        <section id="body" class="body">
            <form method="post" action="restore.html" name="restore" id="restore" enctype="multipart/formdata">
                <p>
                    <label for="filename">File to restore</label>
                    <input type="file" name="filename" id="filename"/>
                </p>
                <p>
                    <button type="submit" id="submit">Submit</button>
                </p>
            </form>
        </section>
    </body>
</html>

如果我选择包含文本的文件并单击“提交”按钮,则不会发送该文件并附上回复。

以下是跟踪的内容:

14:00:54.577664 IP6 localhost.43396 > localhost.8060: Flags [P.], seq 1:614, ack 1, win 342, options [nop,nop,TS val 963497793 ecr 963497793], length 613
    0x0000:  0000 0000 0000 0000 0000 0000 86dd 6000  ..............`.
    0x0010:  0000 0285 0640 0000 0000 0000 0000 0000  .....@..........
    0x0020:  0000 0000 0001 0000 0000 0000 0000 0000  ................
    0x0030:  0000 0000 0001 a984 1f7c ee92 c1db b1ac  .........|......
    0x0040:  d6f7 8018 0156 028d 0000 0101 080a 396d  .....V........9m
    0x0050:  cf41 396d cf41 504f 5354 202f 7265 7374  .A9m.APOST./rest
    0x0060:  6f72 652e 6874 6d6c 2048 5454 502f 312e  ore.html.HTTP/1.
    0x0070:  310d 0a48 6f73 743a 206c 6f63 616c 686f  1..Host:.localho
    0x0080:  7374 3a38 3036 300d 0a55 7365 722d 4167  st:8060..User-Ag
    0x0090:  656e 743a 204d 6f7a 696c 6c61 2f35 2e30  ent:.Mozilla/5.0
    0x00a0:  2028 5831 313b 204c 696e 7578 2078 3836  .(X11;.Linux.x86
    0x00b0:  5f36 343b 2072 763a 3237 2e30 2920 4765  _64;.rv:27.0).Ge
    0x00c0:  636b 6f2f 3230 3130 3031 3031 2046 6972  cko/20100101.Fir
    0x00d0:  6566 6f78 2f32 372e 300d 0a41 6363 6570  efox/27.0..Accep
    0x00e0:  743a 2074 6578 742f 6874 6d6c 2c61 7070  t:.text/html,app
    0x00f0:  6c69 6361 7469 6f6e 2f78 6874 6d6c 2b78  lication/xhtml+x
    0x0100:  6d6c 2c61 7070 6c69 6361 7469 6f6e 2f78  ml,application/x
    0x0110:  6d6c 3b71 3d30 2e39 2c2a 2f2a 3b71 3d30  ml;q=0.9,*/*;q=0
    0x0120:  2e38 0d0a 4163 6365 7074 2d4c 616e 6775  .8..Accept-Langu
    0x0130:  6167 653a 2065 6e2d 6762 2c65 6e3b 713d  age:.en-gb,en;q=
    0x0140:  302e 350d 0a41 6363 6570 742d 456e 636f  0.5..Accept-Enco
    0x0150:  6469 6e67 3a20 677a 6970 2c20 6465 666c  ding:.gzip,.defl
    0x0160:  6174 650d 0a52 6566 6572 6572 3a20 6874  ate..Referer:.ht
    0x0170:  7470 3a2f 2f6c 6f63 616c 686f 7374 3a38  tp://localhost:8
    0x0180:  3036 302f 7265 7374 6f72 652e 6874 6d6c  060/restore.html
    0x0190:  0d0a 436f 6f6b 6965 3a20 5f5f 5345 5353  ..Cookie:.__SESS
    0x01a0:  494f 4e5f 5f3d 6662 3631 6236 6566 3065  ION__=fb61b6ef0e
    0x01b0:  3837 3939 6561 6239 3233 3530 3131 3166  8799eab92350111f
    0x01c0:  6432 6638 3132 3464 3966 3965 6333 6534  d2f8124d9f9ec3e4
    0x01d0:  6234 3337 3965 3234 3039 6335 6462 3231  b4379e2409c5db21
    0x01e0:  3639 3165 6638 3a61 3133 3866 6138 6632  691ef8:a138fa8f2
    0x01f0:  3338 3430 3234 3864 3436 6661 3663 3930  3840248d46fa6c90
    0x0200:  3837 3632 6337 3735 6261 3933 3936 3534  8762c775ba939654
    0x0210:  6261 6563 6265 6465 6261 6466 3437 3963  baecbedebadf479c
    0x0220:  6635 6363 6538 3933 6465 3839 3338 3037  f5cce893de893807
    0x0230:  6266 6566 3961 6434 3232 6539 6462 3837  bfef9ad422e9db87
    0x0240:  6566 3136 3962 340d 0a43 6f6e 6e65 6374  ef169b4..Connect
    0x0250:  696f 6e3a 206b 6565 702d 616c 6976 650d  ion:.keep-alive.
    0x0260:  0a43 6f6e 7465 6e74 2d54 7970 653a 2061  .Content-Type:.a
    0x0270:  7070 6c69 6361 7469 6f6e 2f78 2d77 7777  pplication/x-www
    0x0280:  2d66 6f72 6d2d 7572 6c65 6e63 6f64 6564  -form-urlencoded
    0x0290:  0d0a 436f 6e74 656e 742d 4c65 6e67 7468  ..Content-Length
    0x02a0:  3a20 3139 0d0a 0d0a 6669 6c65 6e61 6d65  :.19....filename
    0x02b0:  3d73 7973 7465 6d2e 6366 67              =system.cfg

这就是所有的回应。下一个数据包是来自服务器的ACK。

很明显,我做错了什么;这在世界各地都有效。有人可以帮忙吗?

1 个答案:

答案 0 :(得分:0)

multipart/form-data

而不是

multipart/formdata