The /UploadJpeg
endpoint is part of a Web API designed for License Plate Recognition (LPR) and Vehicle Make & Model (VMM) processing. This endpoint allows users to upload a JPEG image, which will then be analyzed by the system to extract license plate information and detect vehicle characteristics.
This API accepts a POST
request with the image file included as multipart/form-data
. Once the image is successfully uploaded, it becomes available for further processing by the LPR/VMM engine.
Below is an example in C# demonstrating how to upload a .jpg
image using HttpClient
:
using System;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
var filePath = @"C:\Path\To\Your\File.jpg"; // Replace with your JPEG file path
var url = "http://84.200.6.42:5000/UploadJpeg";
using var client = new HttpClient();
using var multipartContent = new MultipartFormDataContent();
using var fileStream = File.OpenRead(filePath);
using var fileContent = new StreamContent(fileStream);
fileContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("image/jpeg");
multipartContent.Add(fileContent, "file", Path.GetFileName(filePath));
var response = await client.PostAsync(url, multipartContent);
if (response.IsSuccessStatusCode)
{
Console.WriteLine("Upload successful.");
var responseContent = await response.Content.ReadAsStringAsync();
Console.WriteLine("Response: " + responseContent);
}
else
{
Console.WriteLine($"Upload failed. Status code: {response.StatusCode}");
var errorContent = await response.Content.ReadAsStringAsync();
Console.WriteLine("Error: " + errorContent);
}
}
}
Notes: #
- Make sure the file path exists and points to a valid
.jpg
or.jpeg
file. - This assumes the server expects a
multipart/form-data
with a file field. - Adjust
"file"
inmultipartContent.Add(...)
if the API expects a different key name (though Swagger shows none, this is usually “file”).