AzureBlobModel.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using Microsoft.AspNetCore.Http;
  2. using Microsoft.WindowsAzure.Storage.Table;
  3. using System;
  4. namespace HaBookCms.AzureStorage.AzureBlob.Models
  5. {
  6. public class AzureBlobModel :TableEntity
  7. {
  8. public AzureBlobModel() {
  9. }
  10. public AzureBlobModel(IFormFile f ,string Container) {
  11. ContentType = f.ContentType;
  12. ContentDisposition = f.ContentDisposition;
  13. FileName = f.FileName;
  14. Headers = f.Headers;
  15. Length = f.Length;
  16. Name = f.Name;
  17. UploadTime = (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000;
  18. PartitionKey = Container;
  19. RowKey = Guid.NewGuid().ToString();
  20. Extension = f.FileName.Substring(f.FileName.LastIndexOf(".") + 1, (f.FileName.Length - f.FileName.LastIndexOf(".") - 1)); //扩展名
  21. }
  22. //
  23. // 摘要:
  24. // Gets the raw Content-Type header of the uploaded file.
  25. public string ContentType { get; set; }
  26. //
  27. // 摘要:
  28. // Gets the raw Content-Disposition header of the uploaded file.
  29. public string ContentDisposition { get; set; }
  30. //
  31. // 摘要:
  32. // Gets the header dictionary of the uploaded file.
  33. public IHeaderDictionary Headers { get; set; }
  34. //
  35. // 摘要:
  36. // Gets the file length in bytes.
  37. public long Length { get; set; }
  38. //
  39. // 摘要:
  40. // Gets the form field name from the Content-Disposition header.
  41. public string Name { get; set; }
  42. //
  43. // 摘要:
  44. // Gets the file name from the Content-Disposition header.
  45. public string FileName { get; set; }
  46. //上传时间戳
  47. public long UploadTime { get; set; }
  48. //上传时间戳
  49. public string Extension { get; set; }
  50. }
  51. }