Upload

This page describes how you can integrated file upload widget

Upload File

File Upload component

Example.jsx
import MaterialJsonSchemaForm from 'react-jsonschema-form-material-ui';

<MaterialJsonSchemaForm
  schema={schema}
  uiSchema={uiSchema}
  formData={formData}
  onUpload={(file) => console.log("get uploaded file object")} // New addition
/>
schema.json
{
  "title": "Example for rendering upload component",
  "description": "A simple form with upload component",
  "type": "object",
  "properties": {
    "upload": {
      "type": "upload",
      "title": "Please upload your file"
    },
  }
}
uiSchema.json
{
  "upload": {
    "ui:widget": "outlined",
    "ui:accept": "image/*",
    "ui:isMulti": true,
    "ui:buttonTitle": "Upload",
    "ui:icon": "add_circle"
  },
}
formData.json
{
  "upload": "",
}

Last updated