-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multipart POST support #110
Comments
Until this is implemented, AFNetworking's multipart form request functionality can be used in conjunction with Alamofire itself. |
I'm going to use AFNetworking for now as suggested, but I'd love to see this in Alamofire as well! |
Same here. Do you have an idea of when it will be implemented? |
same here.I implemented most of my networking with Alamofire and just integrated AFNetworking for the multipart request...I would really love to see this feature implemented and great work so far, thanks! |
+1 |
Would love to have it in Alamofire too |
Here is a quick&dirty patch I use: http://pastebin.com/k9CUJjry |
+1 who wants multipart support |
@db0company why not make a PR for this? |
@mente Because this is a quick&dirty solution that works for me but might not work for everybody since it's not complete and has hardcoded strings. |
+1 woo and thanks to @db0company - that patch is dope. nyan. |
@mattt looking to implement this using AFNetworking, any estimate on when it will be implemented in Alamofire? |
I've created a class function to upload single file as multipart/form-data based on this SO answers. Class
Usage
|
@tomoyuki28jp I don't have my head around Alamofire routes yet, can you provide the rest of the code for the Photo example? |
@captainchung Take a look at those SO answers. |
Shortly after you responded (8807fb8), you added this to the README:
Sorry to bother you, but could you possibly clarify as to whether you still intend to implement this? |
+1 |
how can i set the params with this input. PATCH i want to put the image param in "profile_photo" |
@mileswd we are going to implement this. We haven't finalized the |
@cnoon Glad to hear this! Thanks for the update 👍 |
Any update ? |
In the meanwhile I have created a very general solution, based on previous comments and stackoverflow questions. |
http://stackoverflow.com/a/26747857/3958295 Thk God. I fixed problem. |
Hey everyone, I just put up PR #539 which adds support for |
You can try this, it is working Alamofire.upload(
.POST,
URLString: "http://blankapp.io/api/v1/update",
multipartFormData: {
multipartFormData in
multipartFormData.appendBodyPart(fileURL: NSURL(fileURLWithPath: imagePath)!, name: "cover")
multipartFormData.appendBodyPart(data: "Alamofire test title".dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)!, name: "title")
multipartFormData.appendBodyPart(data: "test content".dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)!, name: "content")
multipartFormData.appendBodyPart(data: "1".dataUsingEncoding(NSUTF8StringEncoding, allowLossyConversion: false)!, name: "type")
},
encodingCompletion: {
encodingResult in
switch encodingResult {
case .Success(let upload, _, _ ):
upload.responseJSON {
request, response, JSON, error in
println(JSON)
}
case .Failure(let encodingError):
println("Failure")
println(encodingError)
}
}
) |
Can you tell how much time (roughly) takes to implement it? |
@cnoon: Do you have any tricks up your sleeve for diagnosing stalled uploads? I am logging in (Thanks) |
Hi @chrisco314, I've seen some weird throttling on uploads on some ISPs before, but generally, it should just upload consistently. Alamofire doesn't do anything to trigger that behavior in any way. |
@cnoon : I tried by setting parameters as data for the Is this correct or should I add parameters as data to I am using |
You need to add the parameters to the multipart form data @johnykutty. 👍🏼 |
Hello,
do you have any timeframe for Multipart POST?
I would love to use Alamofire, but it's a show stopper for me.
The text was updated successfully, but these errors were encountered: