陈斌彬的技术博客

Stay foolish,stay hungry

AFNetworking 上传图片

测试,服务端项目文件夹收到图片

img

iOS客户端主要代码

img

C#服务端主要代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace RemoteImage
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Files.Count == 0)
            {
                Response.Write("none file");
            }
            else
            {
                HttpPostedFile file = Request.Files["img"];
                String filename = Request.Form["filename"];
                file.SaveAs(MapPath("~/" + filename + ".png"));
                Response.Write("ok");
            }

        }
    }
}