Skip to content

Upload any file through the terminal - Drag/Drop + Paste #1602

Description

@isontheline

Feature Request: Upload any file via SCP from the terminal, with optional "copy remote path" to clipboard

Summary

Add a generic "upload a file to the remote host" action to the WebSSH terminal session, built on SCP. The feature is intentionally file-type agnostic — images, binaries, archives, configs, anything — and decouples the upload from the insertion of the path: after a successful upload, WebSSH asks whether to copy the remote path to the clipboard, so the user can paste it wherever they want (in the terminal, in another app, into a chat with an AI agent, etc.).

A clipboard-image paste shortcut (⌘V on an image) becomes a thin convenience layer on top of this primitive — the same upload pipeline, just pre-fed with the clipboard image.

Motivation

Two related needs:

  1. General SCP-from-the-app workflow: today, sending a local file to the remote host means leaving the terminal, opening an SFTP client (or remembering scp syntax), and typing the destination path manually. A first-class "upload here" action inside WebSSH removes that friction.
  2. AI coding agents need file context: terminal-based assistants (Codex, Claude Code, etc.) increasingly accept file paths — screenshots, logs, configs, PDFs, datasets — for context. Getting a local file onto the remote machine and into the agent's hands is currently a multi-step chore.

Generalizing to "upload any file" rather than "paste images" covers both cases with one feature.

Proposed flow

  1. Choose a file — user triggers the action (toolbar button, menu item, keyboard shortcut, drag-and-drop into the terminal, or ⌘V when the clipboard contains a file/image). Source can be any local file: binary, image, archive, text, etc.
  2. Choose destination — WebSSH prompts for the remote target directory. Defaults are offered (e.g., /tmp, the user's home directory, the current working directory of the shell, or the last-used location). The proposed remote filename is editable.
  3. Upload — WebSSH uploads via SCP, showing progress and surfacing clear errors on failure (permissions, disk full, missing directory, transport unavailable, etc.).
  4. Offer to copy the remote path — once the upload succeeds, WebSSH asks (or shows a quick action) whether to copy the resulting remote path to the system clipboard. The user can also dismiss this and just keep the file on the server.
  5. Paste anywhere — user pastes the path into the terminal, into another app, or into an AI agent prompt.

Image-paste convenience (built on top)

When the clipboard holds an image and the user pastes into the terminal, WebSSH can short-circuit step 1 (file is already chosen) and use a sensible default destination (e.g., /tmp/webssh-uploads/image-YYYY-MM-DD-HHMMSS.png), then continue with steps 3–5.

Design considerations

  • SCPfoundation: this feature requires SCPtransport in the terminal session context. Landing that cleanly is the prerequisite for everything else here.
  • Source options:
    • File picker (native iOS/macOS picker, including iCloud/Files)
    • Drag and drop onto the terminal view
    • Clipboard paste (file or image payload)
    • Optional: share-sheet target on iOS so other apps can "send to WebSSH"
  • Destination:
    • Default suggestions: /tmp, ~, current shell pwd, last-used directory per host
    • Editable filename with a sensible auto-generated default (timestamped for clipboard images, original filename for picked files)
    • Remember per-host preferences
  • Path handling on insert/copy:
    • Quote paths that contain spaces or special characters
    • Optionally offer a "copy as quoted" vs "copy raw" choice
  • Feedback:
    • Inline progress indicator during upload (especially important for large binaries)
    • Clear, actionable error messages
    • Confirmation toast on success ("Uploaded to /tmp/foo.bin — copy path?")
  • Safety / opt-in:
    • Per-connection toggle to enable/disable uploads (some hosts shouldn't accept writes)
    • Confirmation prompt before overwriting an existing remote file
    • Respect remote permissions; never silently sudo
  • Cleanup:
    • Optional auto-cleanup of a dedicated scratch dir (e.g., /tmp/webssh-uploads/) at session end, configurable
  • Behavior whenSCP is unavailable: surface a clear error rather than failing silently or falling back to text paste.

Dependencies

  • SCPupload support in the terminal session context (prerequisite).

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions