Tuesday, 27 August 2013

FTP upload from iPad not executing

FTP upload from iPad not executing

I am using the FTPManger from the link below. I have included the .h and
.m files and the frameworks into my ios application.
https://github.com/nkreipke/FTPManager
The code that i use in my viewController is as bellow. The action starts
the begining of the upload. But when i press the button it goes thru all
those methods but nothing happens and no errors show.
-(IBAction)uploadImage:(id)sender
{
[self upload:@"Default.png" ftpUrl:@"ftp://xxx.xxx.x.xxx" ftpUsr:@"ip100"
ftpPass:@"ftp100100"];
}
//uploading
-(void)startUploading {
man = [[FTPManager alloc] init];
succeeded = [man uploadFile:[NSURL URLWithString:filePath] toServer:server];
[self performSelectorOnMainThread:@selector(uploadFinished) withObject:nil
waitUntilDone:NO];
}
//
-(void)uploadFinished
{
NSLog(@"uploadFinished");
[progTimer invalidate];
progTimer = nil;
filePath = nil;
server = nil;
man = nil;
//test whether succeeded == YES
}
//
-(void)upload:(NSString*)file ftpUrl:(NSString*)url ftpUsr:(NSString*)user
ftpPass:(NSString*)pass {
NSLog(@"Upload");
server = [FMServer serverWithDestination:url username:user password:pass];
filePath = file;
progTimer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self
selector:@selector(changeProgress) userInfo:nil repeats:YES];
[self performSelectorInBackground:@selector(startUploading) withObject:nil];
}
//
-(void)changeProgress {
NSLog(@"changeProgress");
if (!man) {
return;
}
}

No comments:

Post a Comment