标签:pen one ... class channel ring i++ mic for
html:
<input type="file" id="img1" name="img1" /> <input type="file" id="img2" name="img2" /> <button id="btn_submit">multipart/form-data 提交</button>
javascript:
<script> $(function () { $(‘#btn_submit‘).click(function () { var formdata = new FormData(); formdata.append("submittype", "Phone_addMN"); formdata.append("glsort2", "256"); formdata.append("content", "哈哈哈哈啊"); formdata.append("channel", "街拍"); formdata.append("lng", "123"); formdata.append("lat", "121"); formdata.append("file1", $(‘#img1‘)[0].files[0]); formdata.append("file2", $(‘#img2‘)[0].files[0]); $.ajax({ url: "xxxxxxxx.ashx", type: ‘POST‘, data: formdata, dataType: ‘JSON‘, processData: false, contentType: false, success: function (result) { if (result.state) { var n = ""; } else { } } }); }); }); </script>
C#:
var model_submit = new { glsort2 = Common.ObjectToInt(_context.Request["glsort2"]), content = Common.ObjectToString(_context.Request["content"]), channel = Common.ObjectToString(_context.Request["channel"]), Data = new List<Model.API.MicroNews.Phone_ModelSubmit.Item>(), lng = Common.ObjectToString(_context.Request["lng"]), lat = Common.ObjectToString(_context.Request["lat"]) }; for (int i = 0; i < _context.Request.Files.Count; i++) { var file = _context.Request.Files[i]; var extension = Path.GetExtension(file.FileName).ToLower(); .... }
标签:pen one ... class channel ring i++ mic for
原文地址:http://www.cnblogs.com/OleRookie/p/6023348.html