gpt4 book ai didi

iphone - 上传超过 10 MB 的视频有问题吗?

转载 作者:行者123 更新时间:2023-12-03 20:47:19 27 4
gpt4 key购买 nike

我尝试上传超过 10 MB 的视频,当我通过 ASIHTTPRequest 发送它时,它会开始连接,但不会将该电影上传到网络

最佳答案

这可能是由于服务器端的大小限制

-编辑-

使用 NSURLConnection 和以下请求上传(如果您使用多部分表单数据,通常是这种情况):

// some random value

NSString *boundary = @"0xKhTmLbOuNdArY---ThIs_Is_mY_BoUnDaRyY---pqo";


NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url
cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:20.0];
[request setHTTPMethod:@"POST"];


NSString *theContentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@", boundary];
[request setValue:theContentType forHTTPHeaderField:@"Content-type"];

NSData *theData = data;// here use your movie data

//adding the body:
NSMutableData *postBody = [NSMutableData data];

// data part

[postBody appendData:[[NSString stringWithFormat:@"--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
[postBody appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"content\"; filename=\"dummy%i.mp4\"\r\n",[[NSDate date]timeIntervalSince1970]] dataUsingEncoding:NSUTF8StringEncoding]];
[postBody appendData:[[NSString stringWithFormat:@"Content-Type: %@\r\n",contentType] dataUsingEncoding:NSUTF8StringEncoding]];
[postBody appendData:[@"Content-Transfer-Encoding: binary\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]];
[postBody appendData:theData];
[postBody appendData:[@"\r\n" dataUsingEncoding:NSUTF8StringEncoding]];


// final boundary

[postBody appendData:[[NSString stringWithFormat:@"--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];

[request setHTTPBody:postBody];
[request setValue:param forHTTPHeaderField:@"Parameter"];

关于iphone - 上传超过 10 MB 的视频有问题吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4645150/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com