← 返回命令列表

Linux command

http-server-upload 命令

网络

复制后可按需替换文件名、目录或参数。

常用示例

Start upload server on default port 8080

http-server-upload

Start on a specific port with a token

http-server-upload --port [9090] --token [my-secret-token]

Set upload directory and max file size

http-server-upload --upload-dir [./uploads] --max-file-size [500]

Enable automatic folder creation

http-server-upload --enable-folder-creation

Configure via environment variables

PORT=9000 UPLOAD_DIR=~/uploads/ TOKEN=secret http-server-upload

说明

http-server-upload is a simple zero-configuration Node.js command-line HTTP server for uploading files. When running, visit http://localhost:8080/ to access the upload form. Files are uploaded to the current working directory by default. The tool is useful for quick file transfers without setting up full file sharing. An optional token provides basic access protection.

参数

--port _PORT_ (env: PORT)
Server port. Default: 8080. If the port is in use, it is automatically increased until a free port is found.
--upload-dir _DIR_ (env: UPLOAD_DIR)
Directory where uploaded files are stored. Default: current working directory.
--upload-tmp-dir _DIR_ (env: UPLOAD_TMP_DIR)
Temporary directory for uploads before moving to final destination.
--token _TOKEN_ (env: TOKEN)
Optional token required for uploads, providing basic access protection.
--max-file-size _MB_ (env: MAX_FILE_SIZE)
Maximum allowed file size in megabytes. Default: 200.
--disable-auto-port (env: DISABLE_AUTO_PORT)
Prevent automatic port increment if the port is already in use.
--enable-folder-creation (env: ENABLE_FOLDER_CREATION)
Automatically create folders when uploading to a non-existent path.
--path-regexp _REGEX_ (env: PATH_REGEXP)
Regular expression to validate upload paths.
--index-file _FILE_ (env: INDEX_FILE)
Use a custom HTML file for the upload form.
-h, --help
Display help text.

FAQ

What is the http-server-upload command used for?

http-server-upload is a simple zero-configuration Node.js command-line HTTP server for uploading files. When running, visit http://localhost:8080/ to access the upload form. Files are uploaded to the current working directory by default. The tool is useful for quick file transfers without setting up full file sharing. An optional token provides basic access protection.

How do I run a basic http-server-upload example?

Run `http-server-upload` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --port _PORT_ (env: PORT) do in http-server-upload?

Server port. Default: 8080. If the port is in use, it is automatically increased until a free port is found.