upload_progress_json_output
The `upload_progress_json_output` directive enables the output of upload progress information in JSON format.
Description
The upload_progress_json_output directive is part of the NGINX upload progress tracking module, which facilitates monitoring of file uploads as they are transmitted to backend servers. When this directive is used, the upload progress can be retrieved in JSON format, which is suitable for integration with JavaScript applications. This JSON output allows developers to receive detailed progress data, which can be displayed on client-side interfaces to provide users with feedback on upload status. It works in tandem with other directives, specifically upload_progress, which must be set up to track progress with the specified shared memory zone and timeout duration. Without it, no progress tracking data will be available.
Config Example
location /upload {
upload_progress name 1m;
upload_progress_json_output;
}Be sure to enable upload progress tracking with the upload_progress directive, or no progress data will be available.
The JSON responses depend on active upload tracking; without a valid upload progress identifier, the response may be empty.
Make sure your application correctly handles JSON parsing to avoid runtime errors.