zoukankan      html  css  js  c++  java
  • Django上传文件的那些参数

    # ################## 默认文件上传配置 ########################
    from django.core.files.uploadhandler import MemoryFileUploadHandler
    from django.core.files.uploadhandler import TemporaryFileUploadHandler
    
    # List of upload handler classes to be applied in order.
    FILE_UPLOAD_HANDLERS = [
        'django.core.files.uploadhandler.MemoryFileUploadHandler',
        'django.core.files.uploadhandler.TemporaryFileUploadHandler',
    ]
    
    # Maximum size, in bytes, of a request before it will be streamed to the
    # file system instead of into memory.
    # 允许内存中上传文件的大小
    #   合法:InMemoryUploadedFile对象(写在内存)         -> 上传文件小于等于 FILE_UPLOAD_MAX_MEMORY_SIZE
    # 不合法:TemporaryUploadedFile对象(写在临时文件)     -> 上传文件大于    FILE_UPLOAD_MAX_MEMORY_SIZE 且 小于 DATA_UPLOAD_MAX_MEMORY_SIZE
    
    FILE_UPLOAD_MAX_MEMORY_SIZE = 2621440  # i.e. 2.5 MB
    
    # Maximum size in bytes of request data (excluding file uploads) that will be
    # read before a SuspiciousOperation (RequestDataTooBig) is raised.
    # 允许上传内容的大小(包含文件和其他请求内容)
    DATA_UPLOAD_MAX_MEMORY_SIZE = 2621440  # i.e. 2.5 MB
    
    # Maximum number of GET/POST parameters that will be read before a
    # SuspiciousOperation (TooManyFieldsSent) is raised.
    # 允许的上传文件数
    DATA_UPLOAD_MAX_NUMBER_FIELDS = 1000
    
    # Directory in which upload streamed files will be temporarily saved. A value of
    # `None` will make Django use the operating system's default temporary directory
    # (i.e. "/tmp" on *nix systems).
    # 临时文件夹路径
    FILE_UPLOAD_TEMP_DIR = None
    
    # The numeric mode to set newly-uploaded files to. The value should be a mode
    # you'd pass directly to os.chmod; see https://docs.python.org/3/library/os.html#files-and-directories.
    # 文件权限
    FILE_UPLOAD_PERMISSIONS = None
    
    # The numeric mode to assign to newly-created directories, when uploading files.
    # The value should be a mode as you'd pass to os.chmod;
    # see https://docs.python.org/3/library/os.html#files-and-directories.
    # 文件夹权限
    FILE_UPLOAD_DIRECTORY_PERMISSIONS = None
    清风深知杨柳意,啤酒龙虾难相聚。
  • 相关阅读:
    由 基本数据型态转换成 String/ 由 String 转换成 数字的基本数据型态
    屏幕适配(UGUI)非UI
    转载 Unity Text 插入超链接
    File类的使用
    抽奖
    竖倾斜ScrollView
    本地资源_Asset
    小型自动朝向转盘
    简易C# socket
    Lua class
  • 原文地址:https://www.cnblogs.com/zhigu/p/10028799.html
Copyright © 2011-2022 走看看