       if boundTest1 {
         if c == 13 {
           let ei = i - boundary.count - 3
-          if !fileNameValue.isEmpty || !contentTypeValue.isEmpty {
+          if isContentFile {
+            tempFile!.writeBytes(collectToken(ei))
             body.files[nameValue] = BodyFile(name: fileNameValue,
-                contentType: contentTypeValue, data: collectToken(ei))
+                contentType: contentTypeValue, file: tempFile!)
+            tempFile = nil
           } else {
             body.fields[nameValue] = collectString(ei)
           }

    boundTest1 = false
    boundTest2 = false
    boundTest3 = false
  }

  mutating func inContentDataStarted() throws {

      let c = stream[i]
      if boundTest3 && c == 13 {
        let ei = i - boundary.count - 5
        if isContentFile {
          tempFile!.writeBytes(collectToken(ei))
          body.files[nameValue] = BodyFile(name: fileNameValue,
              contentType: contentTypeValue, file: tempFile!)
          tempFile = nil
        } else {
          body.fields[nameValue] = collectString(ei)
        }
