@@ -226,7 +226,7 @@ public VisualRecognition(Credentials credentials)
226226 Log . Error ( "VisualRecognition.Classify()" , "Failed to upload {0}!" , imagePath ) ;
227227 }
228228
229- return Classify ( successCallback , failCallback , imageData , owners , classifierIDs , threshold , acceptLanguage , customData ) ;
229+ return Classify ( successCallback , failCallback , imageData , GetMimeType ( imagePath ) , owners , classifierIDs , threshold , acceptLanguage , customData ) ;
230230 }
231231
232232 /// <summary>
@@ -235,13 +235,14 @@ public VisualRecognition(Credentials credentials)
235235 /// <param name="successCallback">The success callback.</param>
236236 /// <param name="failCallback">The fail callback.</param>
237237 /// <param name="imageData">Byte array of image data.</param>
238+ /// <param name="imageMimeType">The mimetype of the image data.</param>
238239 /// <param name="owners">Owners.</param>
239240 /// <param name="classifierIDs">An array of classifier identifiers.</param>
240241 /// <param name="threshold">Threshold.</param>
241242 /// <param name="acceptLanguage">Accepted language.</param>
242243 /// <param name="customData">Custom data.</param>
243244 /// <returns></returns>
244- public bool Classify ( SuccessCallback < ClassifyTopLevelMultiple > successCallback , FailCallback failCallback , byte [ ] imageData , string [ ] owners = default ( string [ ] ) , string [ ] classifierIDs = default ( string [ ] ) , float threshold = default ( float ) , string acceptLanguage = "en" , Dictionary < string , object > customData = null )
245+ public bool Classify ( SuccessCallback < ClassifyTopLevelMultiple > successCallback , FailCallback failCallback , byte [ ] imageData , string imageMimeType , string [ ] owners = default ( string [ ] ) , string [ ] classifierIDs = default ( string [ ] ) , float threshold = default ( float ) , string acceptLanguage = "en" , Dictionary < string , object > customData = null )
245246 {
246247 if ( successCallback == null )
247248 throw new ArgumentNullException ( "successCallback" ) ;
@@ -264,8 +265,8 @@ public VisualRecognition(Credentials credentials)
264265 req . OnResponse = OnClassifyResp ;
265266 req . Parameters [ "api_key" ] = _apikey ;
266267 req . Parameters [ "version" ] = VersionDate ;
267- req . Headers [ "Content-Type" ] = "application/x-www- form-urlencoded " ;
268- req . Headers [ "Accept-Language " ] = acceptLanguage ;
268+ req . Headers [ "Content-Type" ] = "multipart/ form-data " ;
269+ req . Headers [ "Accept" ] = "application/json" ;
269270
270271 if ( owners != default ( string [ ] ) )
271272 req . Parameters [ "owners" ] = string . Join ( "," , owners ) ;
@@ -275,7 +276,10 @@ public VisualRecognition(Credentials credentials)
275276 req . Parameters [ "threshold" ] = threshold ;
276277
277278 if ( imageData != null )
278- req . Send = imageData ;
279+ {
280+ req . Forms = new Dictionary < string , RESTConnector . Form > ( ) ;
281+ req . Forms . Add ( "images_file" , new RESTConnector . Form ( imageData , imageMimeType ) ) ;
282+ }
279283
280284 return connector . Send ( req ) ;
281285 }
0 commit comments