wavded / ogre

ogr2ogr geojson-focused web client
http://ogre.adc4gis.com
MIT License
266 stars 78 forks source link

Getting 'No file uploaded' message when trying to make POST request from C# #61

Closed patilpradip closed 3 years ago

patilpradip commented 7 years ago

Hi,

I am trying to make POST request to ogre web client from c#. Below is my code:

                HttpClient client = new HttpClient();
                MultipartFormDataContent form = new MultipartFormDataContent();
                HttpContent content = new StreamContent(file.InputStream);
                content.Headers.ContentDisposition = new ContentDispositionHeaderValue("form-data")
                {
                    Name = "upload",
                    FileName = file.FileName
                };
                form.Add(content,"upload",file.FileName);
                var response = (await client.PostAsync("http://ogre.adc4gis.com/convert", form));
                var geoJSON = response.Content.ReadAsStringAsync().Result;

I am getting 'No file uploaded' response. I have also tried setting content-type explicitly as follows: content.Headers.ContentType = new MediaTypeHeaderValue("multipart/form-data");

But still the result is same i.e. getting 'No file uploaded' response.

Any help will be much appreciated.

Thanks

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] commented 3 years ago

This issue was closed because it has been stalled for 5 days with no activity.