• 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
    清风深知杨柳意,啤酒龙虾难相聚。
  • 相关阅读:
    BOM
    no response from Graphic Screen Painter Exiting
    Windows Mobile 中模拟按键
    C# 获取汉字拼音首字母
    Web Service介绍
    .net/c#中栈和堆的区别及代码在栈和堆中的执行流程详解
    使用JSON加速AJAX(By Sean Kelly)
    Sql字符串操作函数
    一个简单AJAX注册示例
    .Net平台开发的技术规范与实践精华总结
  • 原文地址:https://www.cnblogs.com/zhigu/p/10028799.html
Copyright © 2020-2023  润新知