Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
patilpradip opened this issue Nov 23, 2016 · 2 comments
Labels

Comments

@patilpradip
Copy link

patilpradip commented Nov 23, 2016

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
Copy link

github-actions bot commented Feb 2, 2021

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 github-actions bot added the stale label Feb 2, 2021
@github-actions
Copy link

github-actions bot commented Feb 8, 2021

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

@github-actions github-actions bot closed this as completed Feb 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant