[web API] method for uploading files asynchronously #1041

Closed
opened 2026-10-05 00:29:22 +02:00 by adam · 0 comments
Owner

As explained in https://github.com/Piwigo/Piwigo-Mobile/issues/31, third-party apps need an API method for uploading files asynchronously and setting image parameters (no need to call pwg.images.setInfo after the upload). This method would be accessible to Admins and Community users with upload rights.

This method, which we might call pwg.images.uploadAsync, would collect chunks of a file in any order (multipart/form-data encoding). It would reply "status":"ok" (or "fail") after the successful upload of each chunk. Upon reception of the last chunk, the method would recombine all chunks in the right order and compare the MD5 checksum of the reconstructed file with the one provided by the client. It would then reply "status":"ok", the image_id and some other infos as pwg.images.upload does it. If the checksum test fails, it would then return "status":"fail" with an error code and message.

Phones do not always have access to networks and some users wait for a Wi-Fi to complete uploads. So it would be useful to allow this method to wait up to 7 days for collecting all chunks.

Here are the parameters of pwg.images.uploadAsync:

  • file (filename provided with multipart/form-data encoding, mandatory)
  • chunk (current chunk number, mandatory)
  • chunks (number of chunks, mandatory)
  • category (mandatory)
  • original_sum (MD5 checksum, mandatory)
  • username (mandatory unless pwg_token is provided)
  • password (mandatory unless pwg_token is provided)
  • pwg_token (mandatory unless above credentials are provided)
  • name (optional)
  • author (optional)
  • date_creation (optional)
  • comment (optional)
  • tag_ids (optional)
  • level (optional)
  • image_id (optional, used to replace an existing image when provided)
As explained in https://github.com/Piwigo/Piwigo-Mobile/issues/31, third-party apps need an API method for uploading files asynchronously and setting image parameters (no need to call `pwg.images.setInfo` after the upload). This method would be accessible to Admins and Community users with upload rights. This method, which we might call `pwg.images.uploadAsync`, would collect chunks of a file in any order (`multipart/form-data` encoding). It would reply "status":"ok" (or "fail") after the successful upload of each chunk. Upon reception of the last chunk, the method would recombine all chunks in the right order and compare the MD5 checksum of the reconstructed file with the one provided by the client. It would then reply "status":"ok", the `image_id` and some other infos as `pwg.images.upload` does it. If the checksum test fails, it would then return "status":"fail" with an error code and message. Phones do not always have access to networks and some users wait for a Wi-Fi to complete uploads. So it would be useful to allow this method to wait up to 7 days for collecting all chunks. Here are the parameters of `pwg.images.uploadAsync`: - file (filename provided with `multipart/form-data` encoding, mandatory) - chunk (current chunk number, mandatory) - chunks (number of chunks, mandatory) - category (mandatory) - original_sum (MD5 checksum, mandatory) - username (mandatory unless pwg_token is provided) - password (mandatory unless pwg_token is provided) - pwg_token (mandatory unless above credentials are provided) - name (optional) - author (optional) - date_creation (optional) - comment (optional) - tag_ids (optional) - level (optional) - image_id (optional, used to replace an existing image when provided) <!-- github-sync-id:665619354 -->
adam closed this issue 2026-10-05 00:29:22 +02:00
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#1041