The next generation of the Teknik Services. Written in ASP.NET. https://www.teknik.io/
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

UploadController.cs 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using Teknik.Areas.Upload.ViewModels;
  7. using Teknik.Controllers;
  8. namespace Teknik.Areas.Upload.Controllers
  9. {
  10. public class UploadController : DefaultController
  11. {
  12. // GET: Upload/Upload
  13. [HttpGet]
  14. [AllowAnonymous]
  15. public ActionResult Index()
  16. {
  17. return View(new UploadViewModel());
  18. }
  19. // GET: Upload/Upload
  20. [HttpGet]
  21. [AllowAnonymous]
  22. public ActionResult Download(string url)
  23. {
  24. return View(new UploadViewModel());
  25. }
  26. [HttpPost]
  27. [AllowAnonymous]
  28. [ValidateAntiForgeryToken]
  29. public ActionResult Upload(string uploadID)
  30. {
  31. foreach (string fileName in Request.Files)
  32. {
  33. HttpPostedFileBase file = Request.Files[fileName];
  34. //Save file content goes here
  35. string fName = file.FileName;
  36. if (file != null && file.ContentLength > 0)
  37. {
  38. }
  39. }
  40. return Json(new { result = "tempURL.png" });
  41. }
  42. [HttpPost]
  43. [AllowAnonymous]
  44. [ValidateAntiForgeryToken]
  45. public ActionResult Delete(string url, string deleteKey)
  46. {
  47. return Json(new { result = true });
  48. }
  49. [HttpPost]
  50. [AllowAnonymous]
  51. [ValidateAntiForgeryToken]
  52. public ActionResult GenerateDeleteKey(string uploadID)
  53. {
  54. return Json(new { result = "temp-delete-key" });
  55. }
  56. }
  57. }