I am trying to upload a large video file using GCDWebServer
but am unable to upload it. Video with small size is uploaded successfully but problems occur in large video file uploading.
Actually using GCDWebServer
I am importing files from pc to an iOS device and writing those files in the app document path using the below code. first I am removing web forms data from a file and then write it in to app document path.
let dataRequest = request as? GCDWebServerURLEncodedFormRequest
var fileData = dataRequest?.data
if let dataString = String(data: fileData!, encoding: .isoLatin1) {
let split = dataString.components(separatedBy: "\r\n\r\n")
let splitFirst = split.first?.components(separatedBy: "filename=")
let splitName = splitFirst![1].components(separatedBy: "\r\n")
fileName = splitName.first!.replacingOccurrences(of: "\"", with: "", options: NSString.CompareOptions.literal, range: nil)
fileData = split[1].data(using: .isoLatin1)
} else {
// getting nil dataString
}
Now when I try to convert a small uploaded file data to a string I get the result in dataString
, but getting dataString
nil
if the file size is large. eg. 500MB
please, someone suggest me an appropriate answer. GCDWebServer
is a new topic for me.
one more thing GCDWebServer mention the below feature, if anyone has an idea about it please let me know.
- Parser for web forms submitted using "application/x-www-form-urlencoded" or "multipart/form-data" encodings (including file uploads)