Beschränken Sie die Dateieingabe mit React Uploady

import React from "react";
import Uploady from "@rpldy/uploady";
import UploadButton from "@rpldy/upload-button";
import UploadPreview from "@rpldy/upload-preview";

const filterBySize = (file) => {
    return file.size <= 1e+7;
};
    
const App = () => (<Uploady
       destination={{ url: "my-server.com/upload" }}
       fileFilter={filterBySize}
       accept=".png,.jpg,.jpeg"
    >
       <UploadButton/>
       <UploadPreview/>
</Uploady>);
 Run code snippet
Khadidja Arezki