Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void Login(Stream stream)
- {
- string username = null;
- string password = null;
- HttpContentParser parser = new HttpContentParser(stream);
- if (parser.Success)
- {
- username = HttpUtility.UrlDecode(parser.Parameters["username"]);
- password = HttpUtility.UrlDecode(parser.Parameters["password"]);
- }
- }
- public void Upload(Stream stream)
- {
- HttpMultipartParser parser = new HttpMultipartParser(stream, "image");
- if (parser.Success)
- {
- string user = HttpUtility.UrlDecode(parser.Parameters["user"]);
- string title = HttpUtility.UrlDecode(parser.Parameters["title"]);
- // Save the file somewhere
- File.WriteAllBytes(FILE_PATH + title + FILE_EXT, parser.FileContents);
- }
- }
- Microsoft.AspNetCore.Http.IFormCollection form;
- form = ControllerContext.HttpContext.Request.Form;
- using (var fileStream = System.IO.File.Create(strFile))
- {
- form.Files[0].OpenReadStream().Seek(0, System.IO.SeekOrigin.Begin);
- form.Files[0].OpenReadStream().CopyTo(fileStream);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement