# Files

Source: https://projectfeed.app/docs/cli/posts-content/files

Upload files and inspect media records from the CLI.

Upload, list, view, and delete file attachments. Alias: `pf m`

 `pf media list` List media attachments. Filter by exactly one parent type. If no id filter is set, defaults to listing post attachments.

alias: pf m ls

Options

-   `--post` string
    
    Filter by post ID
    
-   `--comment` string
    
    Filter by comment ID
    
-   `--task` string
    
    Filter by task ID
    
-   `--task-comment` string
    
    Filter by task-comment ID
    
-   `--target` string
    
    Override target kind: post | comment | task | taskComment
    
-   `--type` string
    
    Filter by file type: image, video, audio, model, animation, sprite, document, lottie, or file
    
-   `--project` string
    
    Post media only: files on posts in this project
    
-   `--uploader` string
    
    Post media only: files uploaded by this user ID, or me
    
-   `--created-after` string
    
    Post media only: uploaded after this time, as an ISO 8601 time with a timezone or Unix milliseconds. Also --created-before
    
-   `--query` string
    
    Post media only: words in the file name
    
-   `--sort / --order` string
    
    Post media only: sort by createdAt or fileSize, and order asc or desc
    
-   `--limit` number
    
    Max number of results
    
-   `--cursor` string
    
    Cursor for pagination
    

Example

Shell

```
pf media list --task task123
pf media list --comment com123 --type image
pf media list --target task --limit 20
pf media list --uploader me --sort fileSize --order desc
```

 `pf media stats` Count the files you can see on posts, by kind

Options

-   `--project` string
    
    Only files in this project (ID or slug)
    

Example

Shell

```
pf media stats --project website
```

 `pf media posts <id>` List the posts a post file appears on

Example

Shell

```
pf media posts att_abc123
```

 `pf media reorder <post> <ids...>` Set the order of a post's files. List every file ID on the post, first to last. Only the post's author can reorder.

Example

Shell

```
pf media reorder 3 att_def456 att_abc123
```

 `pf media pair <post> <before> <after>` Show two images or GIFs on a post as one before/after with a divider to drag. Either file leaves any pair it was in. Only the post's author can pair files.

Options

-   `--before-label` string
    
    Label for the before side, up to 40 characters (default Before)
    
-   `--after-label` string
    
    Label for the after side, up to 40 characters (default After)
    

Example

Shell

```
pf media pair 3 att_abc123 att_def456 --before-label Day --after-label Night
```

 `pf media unpair <post> <id>` Split a before/after pair back into two files. Pass either file in the pair. Only the post's author can unpair files.

Example

Shell

```
pf media unpair 3 att_abc123
```

 `pf media retry-conversion <id>` Queue a failed 3D model conversion again

Options

-   `--target` string
    
    Target kind: post | comment | task | taskComment (default post)
    

Example

Shell

```
pf media retry-conversion att_abc123
```

 `pf media cancel-upload` Cancel an unattached upload and release its storage reservation. Provider deletion runs in the background. Safe to retry with an expired token. Already attached uploads return a conflict; retry a finalization conflict after it finishes.

Options

-   `--upload-token` string required
    
    Token returned when the upload was prepared.
    

Example

Shell

```
pf media cancel-upload --upload-token "$UPLOAD_TOKEN"
```

 `pf media upload <file>` Upload images, videos, or other files to posts, tasks, comments, Chat, Canvas, or inline Docs. Image settings include avatars, logos, project images, and custom reactions. Exactly one destination flag is required. Uses the same format and size limits as the app, up to 1 GiB. A GIF or WebP animation too large to process is stored as the original file, without resized versions.

alias: pf m upload

Options

-   `--chat-message` string
    
    Chat or portal discussion message ID; requires chat:write
    
-   `--canvas` string
    
    Canvas ID; requires canvas:write
    
-   `--x` string
    
    Canvas x coordinate; default 0
    
-   `--y` string
    
    Canvas y coordinate; default 0
    
-   `--width` string
    
    Canvas item width; default 400
    
-   `--height` string
    
    Canvas item height; default 300
    
-   `--frame` string
    
    Parent canvas frame ID
    
-   `--avatar` string
    
    Your user ID; requires profile:write
    
-   `--workspace-logo` string
    
    Workspace ID; requires owner or admin
    
-   `--project-header` string
    
    Project ID; requires projects:write and project settings access
    
-   `--project-icon` string
    
    Project ID; requires projects:write and project settings access
    
-   `--portal-logo` string
    
    Portal ID; requires owner or admin
    
-   `--portal-banner` string
    
    Public portal ID; requires owner or admin
    
-   `--custom-reaction` string
    
    Workspace ID; requires reactions:write and owner or admin
    
-   `--name` string
    
    Custom reaction name; 2-32 letters, numbers, or underscores
    
-   `--doc` string
    
    Doc ID for a native inline file embed; requires docs:write and media:write
    
-   `--after-block` string
    
    Insert after a top-level Doc block ID; defaults to the end of the Doc
    
-   `--resume-state` string
    
    Save progress to this file. Rerun the same command to resume before the upload expires. The file contains signed URLs; keep it private.
    
-   `--media-type` string
    
    For JSON files: lottie for animation or file for ordinary data
    
-   `--sprite` boolean
    
    Attach a PNG sprite sheet of up to 10 MiB as a sprite, to anything but a doc or image setting. Requires --frame-width, --frame-height, and --frames, and the frame grid must cover the whole sheet. Animated sheets play in the sprite viewer.
    
-   `--sprite-data` string
    
    Attach a PNG as a sprite, with frames from Aseprite's JSON export (Sheet type By rows or a strip, untrimmed) or a spriteSheetData JSON file
    
-   `--frame-width` number
    
    Sprite frame width in pixels
    
-   `--frame-height` number
    
    Sprite frame height in pixels
    
-   `--frames` number
    
    Number of sprite frames, read left to right, then top to bottom
    
-   `--columns` number
    
    Sprite sheet columns; defaults to the sheet width divided by the frame width
    
-   `--rows` number
    
    Sprite sheet rows; defaults to the sheet height divided by the frame height
    
-   `--durations` string
    
    Comma-separated milliseconds per frame, one per frame, such as 55,55,110
    
-   `--fps` number
    
    Sprite framerate; defaults to the mean of --durations, or 12
    
-   `--animation` string
    
    Named animation over 0-based frames, such as walk:0-7; repeat the flag for more
    
-   `--post` string
    
    Post ID to attach media to
    
-   `--comment` string
    
    Comment ID to attach media to
    
-   `--task` string
    
    Task ID to attach media to
    
-   `--task-comment` string
    
    Task-comment ID to attach media to
    
-   `--target` string
    
    Explicit target kind; must match the id flag when both are set
    

Example

Shell

```
pf media upload review.mp4 --post post123 --resume-state ./review-upload.json
pf media upload model.glb --task task456
pf media upload review.mp4 --chat-message message123
pf media upload reference.png --canvas canvas123 --x 200 --y 100
pf media upload diagram.png --doc page123 --after-block block456
pf media upload animation.json --comment com789 --media-type lottie
pf media upload walk.png --post post123 --sprite --frame-width 32 --frame-height 32 --frames 8 --durations 100,100,100,100,100,100,100,150
pf media upload walk.png --task task456 --sprite-data walk.json
```

 `pf media view <id>` View media details. Pass --target for non-post attachments (defaults to post).

alias: pf m show

Options

-   `--target` string
    
    Target kind: post | comment | task | taskComment (default: post)
    

Example

Shell

```
pf media view media123
pf media view media123 --target task
```

 `pf media update <id>` Make a post image you wrote a sprite, change its frames, or turn it back into a plain image. The grid is checked against the image's recorded size. Sprites published from Aseprite with an atlas cannot be changed here.

Options

-   `--sprite` boolean
    
    Set sprite frames from the frame flags
    
-   `--sprite-data` string
    
    Set sprite frames from Aseprite's JSON export or a spriteSheetData JSON file
    
-   `--clear-sprite` boolean
    
    Turn the sprite back into a plain image
    
-   `--frame-width` number
    
    Sprite frame width in pixels
    
-   `--frame-height` number
    
    Sprite frame height in pixels
    
-   `--frames` number
    
    Number of sprite frames, read left to right, then top to bottom
    
-   `--columns` number
    
    Sprite sheet columns; defaults to the image width divided by the frame width
    
-   `--rows` number
    
    Sprite sheet rows; defaults to the image height divided by the frame height
    
-   `--durations` string
    
    Comma-separated milliseconds per frame, one per frame
    
-   `--fps` number
    
    Sprite framerate; defaults to the mean of --durations, or 12
    
-   `--animation` string
    
    Named animation over 0-based frames, such as walk:0-7; repeat the flag for more
    

Example

Shell

```
pf media update media123 --sprite --frame-width 32 --frame-height 32 --frames 8 --durations 55,55,55,55,55,55,55,110
pf media update media123 --sprite-data walk.json
pf media update media123 --clear-sprite
```

 `pf media delete <id>` Delete a media attachment. Pass --target for non-post attachments (defaults to post).

alias: pf m rm

Options

-   `--target` string
    
    Target kind: post | comment | task | taskComment (default: post)
    
-   `--confirm` boolean
    
    Skip confirmation prompt
    
-   `--dry-run` boolean
    
    Preview without deleting
    

Example

Shell

```
pf media delete media123 --confirm
pf media delete media456 --target comment --confirm
```

## Fix file problems

Media attaches to the wrong kind of record

Use exactly one of --post, --comment, --task, or --task-comment. When using --target, make it match the parent ID flag and repeat the same target when viewing or deleting.

An upload fails partway through

Check the file and parent record still exist, keep the same target, and retry once. List the parent's media before retrying to avoid a duplicate attachment after an ambiguous response.

## Next steps

-   [Review file behavior and supported formats](https://projectfeed.app/docs/files/upload-and-browse)
-   [Files API](https://projectfeed.app/docs/api/files)
