http-post

Model always null on XML POST

孤人 提交于 2019-11-26 12:02:30
问题 I\'m currently working on an integration between systems and I\'ve decided to use WebApi for it, but I\'m running into an issue... Let\'s say I have a model: public class TestModel { public string Output { get; set; } } and the POST method is: public string Post(TestModel model) { return model.Output; } I create a request from Fiddler with the header: User-Agent: Fiddler Content-Type: \"application/xml\" Accept: \"application/xml\" Host: localhost:8616 Content-Length: 57 and body: <TestModel>

Send json post using php

放肆的年华 提交于 2019-11-26 11:38:58
I have this data: { userID: 'a7664093-502e-4d2b-bf30-25a2b26d6021', itemKind: 0, value: 1, description: 'Boa saudaÁ„o.', itemID: '03e76d0a-8bab-11e0-8250-000c29b481aa' } and I need to post into json url: http://domain/OnLeagueRest/resources/onleague/Account/CreditAccount using php how can I send this post request? Without using any external dependency or library: $options = array( 'http' => array( 'method' => 'POST', 'content' => json_encode( $data ), 'header'=> "Content-Type: application/json\r\n" . "Accept: application/json\r\n" ) ); $context = stream_context_create( $options ); $result =

Why does naming your HTML form submit button “submit” break things?

杀马特。学长 韩版系。学妹 提交于 2019-11-26 11:36:28
问题 In ASP.NET webforms and ASP 3 (Classic ASP), I came across an issue whereby naming your form submit button \"submit\" would \"break things\". Below is the rendered HTML: <input type=\"submit\" name=\"Submit\" value=\"Submit\" id=\"Submit\" /> I say \"break things\" because I\'m not sure exactly why or what happened. But the symptoms usually were that pressing the submit button sometimes did nothing i.e. it just didn\'t work. But sometimes it did work. In fact, I just built a quick one page

Uploading Images to Server android

…衆ロ難τιáo~ 提交于 2019-11-26 11:35:41
I wanted to know which is the best way to upload image to server without loosing its quality. I have searched on google found various methods of posting data. But I am not sure which one would be best to upload. I came across Multipart Image Upload. Uploading images using byte array Uploading images using base64 encoded string. I have tried Base64 encoding it leads me to OOM(Out of memory) if image is too high in resolution. Any tutorial which tackle this issue would be appreciated. Thanks in advance. Nitin Misra Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); photoPickerIntent

Having troubles calling a Controller Post Method

谁都会走 提交于 2019-11-26 11:33:23
问题 Here\'s my method [AcceptVerbs(HttpVerbs.Post)] public void SaveImage(FormCollection formValues) { byte[] contents = Convert.FromBase64String(Request.Form[\"file\"]); System.IO.File.WriteAllBytes(Server.MapPath(Request.Form[\"name\"]), contents); } It is getting posted to from this actionscript method: public function encodeAndSave(e:MouseEvent = null):void { var date:Date = new Date(); var by:ByteArray = PNGEnc.encode(canvas.main_bdata); var req:URLRequest = new URLRequest(server_path+\"Home

Sending Files using HTTP POST in c# [closed]

白昼怎懂夜的黑 提交于 2019-11-26 11:12:51
问题 I have a small C# web application.How can I get the c# code that allows user to send files by HTTP POST.It should be able to send text files,image files,excel, csv, doc (all types of files) without using stream reader and all. 回答1: You can try the following code: public void PostMultipleFiles(string url, string[] files) { string boundary = "----------------------------" + DateTime.Now.Ticks.ToString("x"); HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url); httpWebRequest

Getting a POST variable

戏子无情 提交于 2019-11-26 10:57:30
问题 I am using C# with ASP.NET. How do I check if a parameter has been received as a POST variable? I need to do different actions if the parameter has been sent via POST or via GET. 回答1: Use this for GET values: Request.QueryString["key"] And this for POST values Request.Form["key"] Also, this will work if you don't care whether it comes from GET or POST, or the HttpContext.Items collection: Request["key"] Another thing to note (if you need it) is you can check the type of request by using:

Reading file input from a multipart/form-data POST

北城以北 提交于 2019-11-26 10:22:43
I'm POSTing a file to a WCF REST service through a HTML form, with enctype set to multipart/form-data and a single component: <input type="file" name="data"> . The resulting stream being read by the server contains the following: ------WebKitFormBoundary Content-Disposition: form-data; name="data"; filename="DSCF0001.JPG" Content-Type: image/jpeg <file bytes> ------WebKitFormBoundary-- The problem is that I'm not sure how do extract the file bytes from the stream. I need to do this in order to write the file to the disk. Darin Dimitrov You may take a look at the following blog post which

Node.js - How to send data from html to express

一个人想着一个人 提交于 2019-11-26 10:08:25
问题 this is form example in html: <!DOCTYPE html> <html> <head> <meta charset=\"utf-8\" /> <title>CSS3 Contact Form</title> </head> <body> <div id=\"contact\"> <h1>Send an email</h1> <form action=\"/myaction\" method=\"post\"> <fieldset> <label for=\"name\">Name:</label> <input type=\"text\" id=\"name\" name=\"name\" placeholder=\"Enter your full name\" /> <label for=\"email\">Email:</label> <input type=\"email\" id=\"email\" placeholder=\"Enter your email address\" /> <label for=\"message\"

Uploading Image via POST in Objective C

六眼飞鱼酱① 提交于 2019-11-26 09:49:25
问题 I\'m currently working on uploading an image to a server via HTTP Post and can\'t seem to figure out a way to build the url that calls the service. The user selects an image from the library or camera and then calls a json service that performs the insert statement. The service is expecting the following uritemplate: @\"%@/DataTransfer/SetUserProfileImage?EMP_ID=%@&image=%@&imageName=%@\" It is expecting that the image data is converted somehow to string and sent over url. This is my current