ZYLUploadFile.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //
  2. // ZYLUploadFile.h
  3. // NetworkLayerBuild
  4. //
  5. // Created by 翟玉磊 on 2017/8/31.
  6. // Copyright © 2017年 翟玉磊. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. //上传类型
  10. typedef enum : NSUInteger {
  11. ZYLUploadFileTypePng,
  12. ZYLUploadFileTypeJpg,
  13. ZYLUploadFileTypeMp3
  14. } ZYLUploadFileType;
  15. @interface ZYLUploadFile : NSObject
  16. + (instancetype)pngImageWithFileData:(NSData *)data imageName:(NSString *)name;/**< 默认以data的md5值做uploadKey */
  17. + (instancetype)jpgImageWithFileData:(NSData *)data imageName:(NSString *)name;/**< 默认以data的md5值做uploadKey */
  18. + (instancetype)mp3AudioWithFileData:(NSData *)data audioName:(NSString *)name;/**< 默认以data的md5值做uploadKey */
  19. + (instancetype)pngImageWithFileData:(NSData *)data imageName:(NSString *)name uploadKey:(NSString *)key;
  20. + (instancetype)jpgImageWithFileData:(NSData *)data imageName:(NSString *)name uploadKey:(NSString *)key;
  21. + (instancetype)mp3AudioWithFileData:(NSData *)data audioName:(NSString *)name uploadKey:(NSString *)key;
  22. /**
  23. 利用参数初始化上传类
  24. @param data NSData数据
  25. @param name 文件名
  26. @param type 上传类型
  27. @param key 上传uploadKey
  28. @return 返回上传类
  29. */
  30. - (instancetype)initWithFileData:(NSData *)data fileName:(NSString *)name fileType:(ZYLUploadFileType)type uploadKey:(NSString *)key;
  31. /**
  32. 获取上传参数
  33. */
  34. - (NSData *)fileData;
  35. - (NSString *)fileName;
  36. - (NSString *)fileType;
  37. - (NSString *)uploadKey;
  38. - (NSString *)md5String;
  39. @end