|
@@ -213,6 +213,20 @@ public class Network {
|
|
|
catch {}
|
|
|
}
|
|
|
|
|
|
+ //print("FULL URL: \(endUrl)")
|
|
|
+ let BOUNDARY = "esuploader-" + "\(Date().currentTimeMillis())"
|
|
|
+ let MIME_TYPE = "multipart/form-data; boundary=" + BOUNDARY
|
|
|
+ let headers: HTTPHeaders = [
|
|
|
+ "Content-Type": MIME_TYPE,
|
|
|
+ "Host": Utils.getURLBase().components(separatedBy: "/")[2],
|
|
|
+ "Accept-Encoding": "gzip, deflate, br",
|
|
|
+ "Connection": "Keep-Alive",
|
|
|
+ "Accept": "*/*",
|
|
|
+ "User-Agent": Utils.getUserAgent(),
|
|
|
+ "Cookie": Utils.getCookiesMobile()
|
|
|
+ ]
|
|
|
+ //print("HEADER: \(headers)")
|
|
|
+
|
|
|
let uploadRequest = AF.upload(multipartFormData: { (multipartFormData: MultipartFormData) in
|
|
|
for (key, value) in parameters {
|
|
|
multipartFormData.append("\(value)".data(using: String.Encoding.utf8)!, withName: key as String)
|
|
@@ -225,9 +239,9 @@ public class Network {
|
|
|
//print(multipartFormData)
|
|
|
}
|
|
|
|
|
|
- }, to: endUrl)
|
|
|
+ }, to: endUrl, headers: headers)
|
|
|
.responseJSON { result in
|
|
|
- if let successResponse = result.value as? [String:Any] {
|
|
|
+ if let response = result.response, response.statusCode == 200, let successResponse = result.value as? [String:Any] {
|
|
|
//print("Response success")
|
|
|
for url in filesIn {
|
|
|
Nexilis.removeUploadFile(forKey: url.lastPathComponent)
|