     class BodyPart {
         let headers: [String: String]
         let bodyStream: NSInputStream
+        let bodyContentLength: UInt64
         var hasInitialBoundary = false
         var hasFinalBoundary = false
 
-        init(headers: [String: String], bodyStream: NSInputStream) {
+        init(headers: [String: String], bodyStream: NSInputStream, bodyContentLength: UInt64) {
             self.headers = headers
             self.bodyStream = bodyStream
+            self.bodyContentLength = bodyContentLength
         }
     }
 

            return errorWithCode(NSURLErrorBadURL, failureReason: "The URL is not reachable: \(URL)")
        }

        if let bodyStream = NSInputStream(URL: URL) {
            let bodyPart = BodyPart(headers: headers, bodyStream: bodyStream)
            self.bodyParts.append(bodyPart)
        } else {
            let failureReason = "Failed to create an input stream from the URL: \(URL)"

        let headers = contentHeaders(name: name, fileName: fileName, mimeType: mimeType)
        let bodyStream = NSInputStream(data: data)
        let bodyContentLength = UInt64(data.length)
        let bodyPart = BodyPart(headers: headers, bodyStream: bodyStream, bodyContentLength: bodyContentLength)

        self.bodyParts.append(bodyPart)
    }
