我有上傳文件通過我的服務器和它工作正常,但我想說明上傳狀態progressview,如何做到這一點,請大家幫我將文件上傳到服務器以在iPhone中顯示UIProgressView?
由於提前
我嘗試這樣做:
[body appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"file\"; filename=\"%@\"\r\n",file] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:[[NSString stringWithString:@"Content-Type: application/octet-stream\r\n\r\n"] dataUsingEncoding:NSUTF8StringEncoding]];
[body appendData:Filedata];
[body appendData:[[NSString stringWithFormat:@"\r\n--%@--\r\n",boundary] dataUsingEncoding:NSUTF8StringEncoding]];
[request setHTTPBody:body];
NSURLConnection *theConnection=[[NSURLConnection alloc] initWithRequest:request delegate:self];
if (theConnection)
mutaebleData = [[NSMutableData data] retain];
else
NSLog(@"No Connection");
使用該委託上傳數據的狀態,但它不會幫助
- (void)request:(NSURLConnection *)request
didSendBodyData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite
{
NSLog(@"%d bytes out of %d sent.", totalBytesWritten, totalBytesExpectedToWrite);
}
感謝您的幫助 – SampathKumar 2013-03-19 06:33:06