Object Storage Service (OSS) does not limit object formats and sizes when you upload objects to OSS. If you want to impose limits on object formats and sizes, you must do it at your business level. This topic describes how to limit object formats and sizes when you use browsers or applications to directly upload objects to OSS.


The environment for the direct data transfer to OSS by using browsers or applications is prepared.

For more information about direct data transfer to OSS, see Add signatures on the client by using JavaScript and upload data to OSS.


You can use Plupload filters to set upload conditions, such as uploading only images, the size of objects to upload, and disabling repeated uploads of an object.

  1. Open the upload.js file.
  2. Add the following fields after var uploader = new plupload.Uploader and save the configurations:
        filters: {
            mime_types : [ // Only images and ZIP files can be uploaded.
            { title : "Image files", extensions : "jpg,gif,png,bmp" },
            { title : "Zip files", extensions : "zip" }
            max_file_size : '400kb', // The size of the object to upload cannot exceed 400 KB.
            prevent_duplicates : true // Objects cannot be uploaded repeatedly.
    • mime_types: limits the extensions of objects to upload.
    • max_file_size: limits the sizes of objects to upload.
    • prevent_duplicates: specifies that an object cannot be uploaded repeatedly.
  3. Open the index.html file and test uploads.
    Click Select Files. Only files that are in the following formats and are 400 KB or smaller in size can be selected: JPG, GIF, PNG, BMP, and ZIP.