Iphone Upload String to FTP server

Go To StackoverFlow.com

0

I need to simply upload a STRING to an ftp server of mine as a txt, i searched well and nothing is working. Is there anyway of simply uploading the string to the ftp server? NOTE: i have looked at s7ftp thing simpleftp and the ftp thing from apple i could not get anything to work.

Thanks in advanced.

2012-04-04 22:15
by M0NKEYRASH


2

Can you create a server-side script to parse a POST/GET string? Seems like uploading a file could be a lot of heavy lifting/coding for something you could do in 3 lines server-side. Just an idea.

Edited addition

Here's some simple Objective-C you can poke around with:

// Create the request.
NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.YOURDOMAIN.com/?string=YOURSTRINGORWHATEVER"]
                        cachePolicy:NSURLRequestUseProtocolCachePolicy
                    timeoutInterval:60.0];
// create the connection with the request
// and start loading the data
NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
if (theConnection) {
    // Create the NSMutableData to hold the received data.
    // receivedData is an instance variable declared elsewhere.
    receivedData = [[NSMutableData data] retain];
} else {
    // Inform the user that the connection failed.
}

Click here for more info on URL Loading

If you can't use ARC or are having troubles with it, try this class. Pretty handy:

SMWebRequest Class on GitHub

Hope this helps.

2012-04-04 22:22
by TNC
This is exactly what I would do. It is extremely easy to do in PHP using the $_GET variable - Ali Hamze 2012-04-04 23:57
i cant even send the string as is - M0NKEYRASH 2012-04-05 01:28
Ok i can do a server side code, but i cant send anything to the server. any ideas?? - M0NKEYRASH 2012-04-05 22:32
I edited the answer above with some sample code - TNC 2012-04-05 22:47
ARC forbids explicit message send of 'retain' Its giving me this error - M0NKEYRASH 2012-04-06 19:12
Thanks but the SMWebRequest had nothing to do with my situation - M0NKEYRASH 2012-04-11 01:52
Um, what you're wanting to do is a HTTP request, it's exactly your situation. Not really sure what else to say or how else to help at this point - TNC 2012-04-11 17:38
Ads