2010-11-19 16 views
1

Video dosyasını belirtilen URL'ye yükseltmeye çalışıyorum. Düğmeye bastığımda video dosyası kullandığım url'e yüklenmelidir. fakat hiçbir yanıt gelmiyor. Herhangi bir kimse bunun için neden verebilir.Video dosyasını URL'ye yüklemek

enter code here 


    NSString *filePath = [[NSBundle mainBundle]pathForResource:@"3idiots" ofType:@"mov"]; 
    NSURL *uploadurl=[NSURL URLWithString:@"http://115.111.27.206:8081/vblo/upload.jsp"]; 

//NSData *postVideoData = [NSData dataWithContentsOfFile:filePath]; 
NSData *postVideoData = [string dataUsingEncoding:NSASCIIStringEncoding   allowLossyConversion:YES]; 
NSString *postVideoLength = [NSString stringWithFormat:@"%d", [postVideoData length]]; 

NSMutableURLRequest *request12 = [[[NSMutableURLRequest alloc] init] autorelease]; 
[request12 setURL:uploadurl]; 
[request12 setHTTPMethod:@"POST"]; 
[request12 setValue:postVideoLength forHTTPHeaderField:@"Content-Length"]; 
[request12 setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; 
[request12 setHTTPBody:postVideoData]; 

NSURLConnection * theConnection12 = [[NSURLConnection alloc] initWithRequest: request12 temsilci: kendi];

halinde (theConnection12) { webData12 = [[NSMutableData verileri] korumak]; (NSURLConnection *) bağlantısı didReceiveResponse: (NSURLResponse *) tepki {

[webData12 setLength:0]; 

(boşluk) bağlantısı - Başka {

}

}

} } - (void) bağlantı: (NSURLConnection *) bağlantısı didReceiveData: (N SDATA *) veri {

[webData12 appendData:data]; 

} - (void) connectionDidFinishLoading: (NSURLConnection *) bağlantısı { NSString * loginStatus12 = [[alloc] initWithBytes NSString: [webData12 mutableBytes] uzunluğu: [webData12 uzunluk] kodlama: NSUTF8StringEncoding]; NSLog (loginStatus12);

if(loginStatus12) 
{ 
    UIAlertView *statusAlert12 = [[UIAlertView alloc]initWithTitle:nil message:(NSString *)loginStatus12 delegate:self cancelButtonTitle:@"cancel" otherButtonTitles:nil]; 
    [statusAlert12 show]; 
} 
} 
+0

gerçekten bu kodu temizlemek gerekir HTTPBody ayarladıktan sonra bu satırı ekleyin, isteği göndermek gerekiyor, ise aynı zamanda ne ... okunması zor değişken "string", gerçek video verisini yorumladığınız gibi görünüyor. –

cevap

0

Eğer

NSData *serverReply = [NSURLConnection sendSynchronousRequest: request12 returningResponse:&response error:&error]; 
+0

u cevap için çok teşekkür ederim bunu kullandım, ama herhangi bir cevap vermedim. – sny

+0

Buraya bir göz atın http://www.cocoadev.com/index.pl?HTTPFileUpload –

+0

Değerli sugession için teşekkürler. Kodumda neyin yanlış olduğunu öğrenebilir miyim. – sny

İlgili konular