This commit is contained in:
s426226 2020-12-14 11:04:07 +01:00
parent 7687c54609
commit c2c1cfe943
3 changed files with 4 additions and 3 deletions

View File

@ -151,7 +151,7 @@ namespace Klient.Droid
using(var byteArrayContent = new ByteArrayContent(await stramContent.ReadAsByteArrayAsync())) using(var byteArrayContent = new ByteArrayContent(await stramContent.ReadAsByteArrayAsync()))
using(var formDataContent = new MultipartFormDataContent()) using(var formDataContent = new MultipartFormDataContent())
{ {
formDataContent.Add(byteArrayContent, "file", Guid.NewGuid() + ".jpg"); formDataContent.Add(byteArrayContent, "image", Guid.NewGuid() + ".jpg");
foreach (var content in formDataContent) foreach (var content in formDataContent)
{ {
content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(ContentResolver.GetType(photo.Data)); content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue(ContentResolver.GetType(photo.Data));

View File

@ -15,6 +15,7 @@
android:text="Wyślij zdjęcie" android:text="Wyślij zdjęcie"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/SendPhoto" /> android:id="@+id/SendPhoto"
android:onClick="SendPhoto"/>
</LinearLayout> </LinearLayout>

View File

@ -20,7 +20,7 @@ namespace Serwer.Api.Controllers
} }
[HttpPost("Process")] [HttpPost("Process")]
public async Task<IActionResult> Process(IFormFile image) public async Task<IActionResult> Process([FromForm]IFormFile image)
{ {
if(image == null) if(image == null)
{ {