|
|
#1 |
|
File upload using curl.
Hi All,
One of the requirements of my cocoa app on Lion (using xcode) is to upload an file to an upload server as a "multipart/form-data" using HTTP POST. I achieve the upload using NSURLConnections when I am connected via ethernet. For some reason When I am connected via WiFi, the upload using NSURLConnection seems to fail (with an error 504). But when I try to upload the same file to the same URL using CURL the same succeeds. Not sure why this behavior is exhibited. I use the following curl command Code:
curl --form file=@/Volumes/Untitled/fig1.png http://xxxx.com/upload Note: the url specified in the sample above is dummy. Now I am trying to implement the http upload using CURL programatically. I've tried using the sample provided in http://curl.haxx.se/mail/lib-2008-01/0322.html but unable to succeed in uploading. Also tried my hands on CurlHandle library but still no success. I might be missing something very silly. It might be too much to ask in a forum, but is it possible for some of you gurus to actually post an curl code which you know for sure does http post upload without giving any error. Thanks & Regards. |
|
|
|
0
|
|
|
#2 |
|
Have you tried looking at a networking framework such as MKNetworkKit or ASINetwork to handle the uploading for you?
__________________
2.4 MacBook Aluminum 480GB SSD/750GB Optibay 8GB RAM CE | MacBook 2.4 SR 4GB, 320GB HD | PB G4 1.67 | 15 TiBook-DVI 800 iPhone 4S 16GB | iPhone 5 32GB
|
|
|
|
0
|
|
|
#3 |
|
I asked about something similar in a few posts below. I could not get the ASINetwork stuff working? Downloading from the web is an easy task but uploading is a major pain. My code logs in successfully and then just hangs and does nothing?
I am curious if you figure this out.
__________________
I know more than yesterday. Lars |
|
|
|
0
|
|
|
#4 |
|
Hi KoolStar,
Thanks for the reply. Sorry for the delay to respond. I am not familiar with either of these networking framework. I managed to get the upload using Curlhandle working. Not sure why it was not working earlier. Have uploaded the test app which perform an HTTP POST and GET using CURLHandle. Hi larswik, Hope this test app helps you with the upload. Note: In the uploaded project, pls replace the place holders for upload and download URL strings with valid values. Last edited by mycompuser; Jan 13, 2013 at 12:04 PM. |
|
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
All times are GMT -5. The time now is 03:11 PM.







Linear Mode
