@@ -25,6 +25,7 @@ @interface QNFormUpload ()
25
25
@property (nonatomic , strong ) QNUploadOption *option;
26
26
@property (nonatomic , strong ) QNUpCompletionHandler complete;
27
27
@property (nonatomic , strong ) QNConfiguration *config;
28
+ @property (nonatomic , strong ) NSString *fileName;
28
29
@property (nonatomic ) float previousPercent;
29
30
30
31
@property (nonatomic , strong ) NSString *access; // AK
@@ -35,6 +36,7 @@ @implementation QNFormUpload
35
36
36
37
- (instancetype )initWithData : (NSData *)data
37
38
withKey : (NSString *)key
39
+ withFileName : (NSString *)fileName
38
40
withToken : (QNUpToken *)token
39
41
withCompletionHandler : (QNUpCompletionHandler)block
40
42
withOption : (QNUploadOption *)option
@@ -48,6 +50,7 @@ - (instancetype)initWithData:(NSData *)data
48
50
_complete = block;
49
51
_httpManager = http;
50
52
_config = config;
53
+ _fileName = fileName != nil ? fileName : @" ?" ;
51
54
_previousPercent = 0 ;
52
55
_access = token.access ;
53
56
}
@@ -56,11 +59,8 @@ - (instancetype)initWithData:(NSData *)data
56
59
57
60
- (void )put {
58
61
NSMutableDictionary *parameters = [NSMutableDictionary dictionary ];
59
- NSString *fileName = _key;
60
62
if (_key) {
61
63
parameters[@" key" ] = _key;
62
- } else {
63
- fileName = @" ?" ;
64
64
}
65
65
parameters[@" token" ] = _token.token ;
66
66
[parameters addEntriesFromDictionary: _option.params];
@@ -119,7 +119,7 @@ - (void)put {
119
119
[_httpManager multipartPost: thirdHost
120
120
withData: _data
121
121
withParams: parameters
122
- withFileName: fileName
122
+ withFileName: _fileName
123
123
withMimeType: _option.mimeType
124
124
withCompleteBlock: thirdComplete
125
125
withProgressBlock: p
@@ -129,7 +129,7 @@ - (void)put {
129
129
[_httpManager multipartPost: nextHost
130
130
withData: _data
131
131
withParams: parameters
132
- withFileName: fileName
132
+ withFileName: _fileName
133
133
withMimeType: _option.mimeType
134
134
withCompleteBlock: retriedComplete
135
135
withProgressBlock: p
@@ -139,7 +139,7 @@ - (void)put {
139
139
[_httpManager multipartPost: upHost
140
140
withData: _data
141
141
withParams: parameters
142
- withFileName: fileName
142
+ withFileName: _fileName
143
143
withMimeType: _option.mimeType
144
144
withCompleteBlock: complete
145
145
withProgressBlock: p
0 commit comments