通过浏览iphone中的文件上传和发送文件
我正在制作一个应用程序,用户可以在其中聊天,也可以从该应用程序发送文件。但我坚持认为,用户可以通过附件向其他用户发送任何文件,但我没有找到任何示例应用程序或帮助代码,因此任何人都可以帮助我解决问题通过浏览iphone中的文件上传和发送文件,iphone,ios,xcode,file-upload,Iphone,Ios,Xcode,File Upload,我正在制作一个应用程序,用户可以在其中聊天,也可以从该应用程序发送文件。但我坚持认为,用户可以通过附件向其他用户发送任何文件,但我没有找到任何示例应用程序或帮助代码,因此任何人都可以帮助我解决问题 告诉我一些示例应用程序链接,以及通过使用应用程序从iPhone浏览文件来上传和发送文件的技术。实现这一点的一些建议 首先让我给你一些建议,像这样从设备上传文件 一, 2现在只需通过ASIFormDataRequest将媒体上传到Web服务,然后他们将生成链接并返回给链接。然后,您可以通过xmpp将
告诉我一些示例应用程序链接,以及通过使用应用程序从iPhone浏览文件来上传和发送文件的技术。实现这一点的一些建议
首先让我给你一些建议,像这样从设备上传文件 一, 2现在只需通过ASIFormDataRequest将媒体上传到Web服务,然后他们将生成链接并返回给链接。然后,您可以通过xmpp将该链接发送给另一个用户。然后其他用户可以下载该媒体
-(NSMutableArray*)sendData:(NSString*)multiMData
{
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:@"http://194.158.1.25/IphoneVideoService/webservice.asmx/GetData1"]];
[request addRequestHeader: @"Content-Type" value:
@"application/x-www-form-urlencoded"];
[request setDelegate:self];
[request setDidFailSelector:@selector(uploadFailed:)];
[request setUploadProgressDelegate:progressToDownload];
[request setDidFinishSelector:@selector(uploadFinished:)];
[request setDidFinishSelector:@selector(requestFailed:)];
[request setDidFinishSelector:@selector(requestFinished:)];
[request setShouldContinueWhenAppEntersBackground:YES];
NSString *url = [[NSURL fileURLWithPath:multiMData] path];
[request setFile:url withFileName:[NSString stringWithFormat:@"Hello.jpeg"] andContentType:@"image/jpeg" forKey:@"file"];
[request setTimeOutSeconds:50000];
[request setRequestMethod:@"POST"];
[request startSynchronous];
SBJSON *sbJason = [[SBJSON alloc] init];
NSMutableArray *getUploadArray = [sbJason objectWithString:responseForMedia];
return getUploadArray;
}
与xmpp框架聊天?
-(NSMutableArray*)sendData:(NSString*)multiMData
{
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:@"http://194.158.1.25/IphoneVideoService/webservice.asmx/GetData1"]];
[request addRequestHeader: @"Content-Type" value:
@"application/x-www-form-urlencoded"];
[request setDelegate:self];
[request setDidFailSelector:@selector(uploadFailed:)];
[request setUploadProgressDelegate:progressToDownload];
[request setDidFinishSelector:@selector(uploadFinished:)];
[request setDidFinishSelector:@selector(requestFailed:)];
[request setDidFinishSelector:@selector(requestFinished:)];
[request setShouldContinueWhenAppEntersBackground:YES];
NSString *url = [[NSURL fileURLWithPath:multiMData] path];
[request setFile:url withFileName:[NSString stringWithFormat:@"Hello.jpeg"] andContentType:@"image/jpeg" forKey:@"file"];
[request setTimeOutSeconds:50000];
[request setRequestMethod:@"POST"];
[request startSynchronous];
SBJSON *sbJason = [[SBJSON alloc] init];
NSMutableArray *getUploadArray = [sbJason objectWithString:responseForMedia];
return getUploadArray;
}