如何读取django中的request.payload内容?

时间:2018-04-20 05:23:01

标签: django http-post httprequest

我想根据request.payload -

的内容做出一些决定
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<div class="maindiv">

        <h2>1. Create caret with css</h2>

        <div class="select caret">
            <select name="" id="">
            <option value="">Item 1</option>
            <option value="">Item 2</option>
            <option value="">Item 3</option>
        </select>
        </div>

        <div class="select angle">
            <select name="" id="">
            <option value="">Item 1</option>
            <option value="">Item 2</option>
            <option value="">Item 3</option>
        </select>
        </div>

        <h2>2. Use Font awesome Libraray or Any other font Library Just include the style file in header</h2>

        <div class="select-font caret">
            <select name="" id="">
            <option value="">Item 1</option>
            <option value="">Item 2</option>
            <option value="">Item 3</option>
        </select>
        </div>

        <div class="select-font angle">
            <select name="" id="">
            <option value="">Item 1</option>
            <option value="">Item 2</option>
            <option value="">Item 3</option>
        </select>
        </div>


    </div>

基本上想要读取文件名是否存在于此?我怎样才能做到这一点? XPKHmxbGVRRE9kUz5K6MtwL15NDedDHDb9IcTohZH7Vnrd0k5D4I0zjD4YR6yjhb ------WebKitFormBoundaryVL2R7CYuDDjkPX51 Content-Disposition: form-data; name="filename"; filename="abc.pdf" Content-Type: application/pdf 似乎不正确。

1 个答案:

答案 0 :(得分:2)

检查request.FILES!这就是你通常用于上传文件的内容!

https://docs.djangoproject.com/en/2.0/ref/request-response/#django.http.HttpRequest.FILES