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 1445
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 1792
Cancels the current file upload and notifies the server.
Name Type Description
callback function Callback to execute after cancellation.

compute_progresss()

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

get_file_path_name(){string}

ajax.js, line 1755
Name the server must use for this file : its relative path when the browser provides one (folder selection, webkitRelativePath), its name otherwise.
Returns:
Type Description
string

init(fileLst)

ajax.js, line 1916
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.

on_load_chunk(evt)

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

on_progress_chunk(evt)

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

pause_file()

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

process_queue()

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

send_chunk(){boolean}

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

unpause_file()

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