我正在关注 如何发布表单数据和文件的博客中的指南.我试图在服务器上的目录上传文件已完成以下但它无法正常工作.
这是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) 当我尝试在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)
有什么我想念的吗?