Upload files

This function uploads files.

Note:

For more information about how to use this function in your custom code, read our Use UAPI's Fileman::upload_files Function in Custom Code tutorial.

Important:

When you disable the File Storage role, the system disables this function.

Authorizations:
query Parameters
dir
required
string <path>

The directory, relative to the user's home directory, to which to upload the files.

Example: dir=public_html
file
required
string

The files to upload.

Important:

  • You must pass this parameter for each file to upload.
  • You must increment each variable. For example, pass the first file as file-1 and the second file as file-2.
Examples:
file=file-1=nail.html&file-2=nail2.html&file-3=nail2.html
file=nail.html
getdiskinfo
integer
Default: 0

Whether to display the disk information after the upload finishes.

  • 1 - Display the disk information after the upload finishes.
  • 0 - Do *not display the disk information after the upload finishes.
Enum: 0 1
Example: getdiskinfo=0
overwrite
integer
Default: 0

Whether to overwrite any files with identical names.

  • 1 - Overwrite any files with identical names.
  • 0 - Do *not overwrite any files with identical names.
Enum: 0 1
Example: overwrite=0
permissions
string
Default: "0644"

The file's file-system permissions.

Example: permissions=0755

Responses

Response Schema: application/json
apiversion
integer

The version of the API.

func
string

The name of the method called.

module
string

The name of the module called.

object

Request samples

uapi --output=jsonpretty \
  --user=username \
  Fileman \
  upload_files \
  dir='public_html' \
  file='nail.html'

Response samples

Content type
application/json
{
  • "apiversion": 3,
  • "func": "upload_files",
  • "module": "Fileman",
  • "result": {
    • "data": {
      • "diskinfo": {
        • "file_upload_max_bytes": "∞",
        • "file_upload_must_leave_bytes": "∞",
        • "file_upload_remain": "∞",
        • "fileslimit": "∞",
        • "filesremain": "∞",
        • "filesused": "∞",
        • "spacelimit": "∞",
        • "spaceremain": "∞",
        • "spaceused": "∞"
        },
      • "uploads": [
        • {
          • "file": "example.html",
          • "reason": null,
          • "size": 100,
          • "status": 1,
          • "warnings": [
            • null
            ]
          }
        ]
      },
    • "errors": null,
    • "messages": null,
    • "metadata": { },
    • "status": 1,
    • "warnings": null
    }
}