|Jan 10, 2013, 09:51 AM||#1|
File upload using curl.
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
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.
|Jan 10, 2013, 10:58 AM||#2|
Have you tried looking at a networking framework such as MKNetworkKit or ASINetwork to handle the uploading for you?
"Innovation distinguishes between a leader and a follower." : S.J.
|Jan 10, 2013, 04:24 PM||#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.
|Jan 13, 2013, 12:57 PM||#4|
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.
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 01:04 PM.
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|How Can I Rename/Delete a File While In The "Select File To Upload" Window?||JJ2Man||OS X 10.8 Mountain Lion||1||Aug 6, 2013 06:38 AM|
|Upload any kind of file (pdf, jpg, etc) to iTunes Match||arubinst||iCloud and Apple Services||1||Jan 9, 2013 09:24 AM|
|How do I upload an excel file to a post?||Apple fanboy||Site and Forum Feedback||4||Oct 28, 2012 06:54 PM|
|Any tweak to upload file from iPad||ipos||Jailbreaks and iOS Hacks||0||Jun 4, 2012 02:11 AM|
All times are GMT -5. The time now is 07:44 AM.