小编LL *_*neh的帖子

在web Api和angularJS中上传文件和表单数据

我正在关注 如何发布表单数据和文件的博客中的指南.我试图在服务器上的目录上传文件已完成以下但它无法正常工作.

这是Post功能

[HttpPost]
        public async Task<HttpResponseMessage> UploadFile(HttpRequestMessage request)
        {
            String root = HttpContext.Current.Server.MapPath("~/Logo/");

            if (!request.Content.IsMimeMultipartContent())
            {
                throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType);
            }

            var data = await Request.Content.ParseMultipartAsync();
            var httpRequest = HttpContext.Current.Request;

            if (data.Files.ContainsKey("file"))
            {

                var file = data.Files["file"].File;      // this is getting the file
                var fileName = data.Files["file"].Filename; // this is getting the fileName
               // System.Web.HttpPostedFile filePost = data.Files["file"];
                String a = root + "" + Path.GetFileName(fileName);
                string b = a;
                var postedFile = fileName;                                                  // this is not …
Run Code Online (Sandbox Code Playgroud)

c# asp.net angularjs asp.net-web-api2

8
推荐指数
2
解决办法
2万
查看次数

在symfony2中注销后我无法清除我的会话

当我尝试在symfony2中注销我的会话支持被完全清除但是如果我点击浏览器后退按钮我可以进入我以前的会话

 firewalls:
    main:
        pattern: /.*
        form_login:
            login_path: /login
            check_path: /login_check
            default_target_path: /hrs/applyleave/
        logout: 
            path: /logout
            target: /login
            path: security_admin_logout
            target: security_admin_login
            invalidate_session: true
            delete_cookie:~
        security: true
        anonymous: true
Run Code Online (Sandbox Code Playgroud)

有什么我想念的吗?

php symfony

1
推荐指数
1
解决办法
1072
查看次数

标签 统计

angularjs ×1

asp.net ×1

asp.net-web-api2 ×1

c# ×1

php ×1

symfony ×1