Class: H_ajax_file

H_ajax_file

Handles chunked file uploads via AJAX, including progress tracking, adaptive chunk sizing, error handling, pause/resume, and merging chunks on the server.

new H_ajax_file(fileLst, original_sender)

ajax.js, line 1407
Name Type Description
fileLst Array List of files to upload.
original_sender H_ajax_sender The original AJAX sender.

Methods

cancel_file(callback)

ajax.js, line 1732
Cancels the current file upload and notifies the server.
Name Type Description
callback function Callback to execute after cancellation.

compute_progresss()

ajax.js, line 1681
Computes progress for the current file and all files.

init(fileLst)

ajax.js, line 1850
Initializes the upload queue and progress tracking.

parse fileLst and put in this.queue for each dom_id found in it.
A dom_id correspond to an uploader widget.
File is an object with data, the FIleobject from the navigator and dom_id to retrieve the uploader widget
dom_id can be false or a string.
if false can't do the upload progress (can't retrieve the sender)
when using the uploader widget from media it should always be the string reference to the widget otherwise it's a custom send and you should use the upload callback of the ajax sender
Name Type Description
fileLst Array List of files to upload.

merge_file()

ajax.js, line 1701
Sends a merge request to the server after all chunks are uploaded.

on_load_chunk(evt)

ajax.js, line 1565
Handles the load event for a chunk upload.
Name Type Description
evt Event The event object.

on_progress_chunk(evt)

ajax.js, line 1646
Handles progress events for a chunk upload.
Name Type Description
evt ProgressEvent The progress event.

pause_file()

ajax.js, line 1753
Pauses the current file upload.

process_queue()

ajax.js, line 1767
Processes the upload queue, sending the next file or finishing.

send_chunk(){boolean}

ajax.js, line 1502
Sends the next file chunk.
Returns:
Type Description
boolean False if not sent.

unpause_file()

ajax.js, line 1759
Resumes a paused file upload.