Re: Avoiding UI hangs
Re: Avoiding UI hangs
- Subject: Re: Avoiding UI hangs
- From: Sanri Parov <email@hidden>
- Date: Sun, 4 Sep 2005 11:43:34 +0200
On Sun, 4 Sep 2005 11:19:52 +0200, Sanri Parov wrote:
> Hi everybody,
>
> I'm doing an application for a customer of mine which requires the
> capability to upload a file to a certain server.
I add some more informations, as far I've seen I've not explained my
self quite well.
The upload button calls send: selector
- (IBAction)send:(id)sender
{
NSString *fileToUpload;
fileToUpload = [NSString
stringWithFormat:@"%@/%@/%@.mp3",[g_finPrincipale
title],[g_lingueTitolo stringValue],[g_lingueTitolo stringValue]];
// Executing upload
NSString *urlString = [NSString
stringWithFormat:@"ftp://%@:%@@%@/%@%@",
WEBUSER_DEF,WEBPASSWD_DEF,WEBSITE_DEF,WEBDIR_DEF,[fileToUpload
lastPathComponent]];
NSURL *url = [NSURL URLWithString:urlString];
CURLHandle *urlHandle = [[CURLHandle alloc] initWithURL:url
cached:NO] ;
[urlHandle setPutFile:fileToUpload];
[self startUpload:urlHandle];
}
-(void)startUpload:(CURLHandle *)handle
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[handle prepareAndPerformCurl];
if (![[handle curlError] isEqualToString:@""])
{
NSBeginAlertSheet(@"Upload
error",@"Ok",nil,nil,g_finPrincipale,self,nil,nil,nil,[NSString
stringWithFormat:@"Upload failed\nHere's the error generated by
CURL:\n\n %@",[handle curlError]]);
return;
}
[pool release];
return;
}
--
Sanri Parov
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden