# HTTP multipart/form-data processing by server

**URL:** https://discourse.julialang.org/t/http-multipart-form-data-processing-by-server/24076
**Category:** Web Stack
**Created:** [May 10, 2019, 2:18pm UTC](https://discourse.julialang.org/t/http-multipart-form-data-processing-by-server/24076 "2019-05-10T14:18:09Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![rssdev10](https://avatars.discourse-cdn.com/v4/letter/r/e9a140/32.png) [@rssdev10](https://discourse.julialang.org/u/rssdev10)
#### Post date: [May 12, 2019, 6:07pm UTC](https://discourse.julialang.org/t/http-multipart-form-data-processing-by-server/24076/2 "2019-05-12T18:07:10Z")

</div>

Workaround for now (it is working at least in my demo app):

```julia
import HTTP, HTTP.Parsers
"""
  returns embedded data or nothing
"""
function parse_multipart(data::Vector{UInt8})
    chunk_end = HTTP.Parsers.find_end_of_chunk_size(data)
    if chunk_end == 0
        return nothing
    end

    boundary = data[1:chunk_end - 2] # should be without \r\n
    header_end = HTTP.Parsers.find_end_of_header(data)

    data_start = header_end + 1
    data_end = length(data) - chunk_end - 2
    # check that block ending is with same boundary + two additional hyphens
    if (data[data_end + 1: end] == [boundary..., 0x2d, 0x2d, 0x0d, 0x0a])
       return data[data_start : data_end]
    end

    return nothing
end

...
data = parse_multipart(c.conn.request.body)

```

Looks like there is a pull request with similar function but still not merged into HTTP - [https://github.com/JuliaWeb/HTTP.jl/pull/264](https://github.com/JuliaWeb/HTTP.jl/pull/264)

---

_[View the full topic](https://discourse.julialang.org/t/http-multipart-form-data-processing-by-server/24076)._
