Embed Large-File Uploads and Downloads in Web Pages

Implementation Approach

The Web Control is created by including the script and stylesheet on the page, specifying the element where the control will be rendered, and calling exabyter.create(). A single control can handle both uploads and downloads, and transferMode can restrict it to a specific purpose.

Overview

What Is Web Embedding

This approach renders a file transfer control in a specific page element (for example, <div id="fileControl">) and controls transfers through the control object returned by exabyter.create(options). The control splits files into slices and transfers them in parallel across multiple sessions, enabling reliable handling of files ranging from several GB to tens of GB that are difficult to transfer with standard browser uploads.

Common Setup

Include Resources — Page <head>to and the does.

html
<link rel="stylesheet" type="text/css" href="/exabyter/exabyter.css">
<script src="/exabyter/exabyter.js"></script>

Container Element — controlis the does.

html
<div id="fileControl"></div>

Create the Controlexabyter.create()to Option the control is returnis performed.

html
<script>
  var control = exabyter.create({
    setElementID: '#fileControl',
    setViewType: 'ListView',
    transferMode: 'both',
    setUploadURL: '/exabyter/example/upload.jsp'
  });
</script>

Server Endpoints — Upload Receiveand Download is Server is does.

PurposeEndpointOption
Upload Receiveupload.jspsetUploadURL / uploadURL
Downloaddownload.jspDownload Listof downloadURL
Transfer Monitor (Optional)transferInfo.jspmonitorURL

Core APIs

PurposeCall
Create the Controlexabyter.create(options)
File Selection Dialogcontrol.openFileDialog()
Folder Selection Dialogcontrol.directoryDialog()
Upload Startcontrol.upload()
Download List specificationcontrol.setDownloadList(items)
Download Startcontrol.download()

Basic Flow

  1. Pageto exabyter.css · exabyter.js
  2. controlthe Container Element
  3. exabyter.create(options) Create the Control → control
  4. (Upload) control.openFileDialog() File Attach → control.upload()
  5. (Download) control.setDownloadList(items) List specification → control.download()

Choose an Implementation Approach

Description

A single control supports both uploads and downloads. Use transferMode to define its purpose and setTransferStart to choose whether transfers start automatically after files are attached or a list is set, or start manually, such as by clicking a button.

Options

OptionValueDescription
transferMode"both" · "upload" · "download"controlis Process Transfer Direction
setTransferStart.upload"auto" · "manual"File Attach after Upload Automatic/Manual Start
setTransferStart.download"auto" · "manual"List specification after Download Automatic/Manual Start
setViewType"ListView" etc.control View

Example

html
<script>
  var control = exabyter.create({
    setElementID: '#fileControl',
    setViewType: 'ListView',
    transferMode: 'both',
    setTransferStart: {
      upload: 'auto',      // Attach immediately Upload
      download: 'manual'   // List specification after to Start
    },
    setUploadURL: '/exabyter/example/upload.jsp'
  });
</script>

Process

  1. transferMode Upload ·Download ·Direction
  2. setTransferStart Direction Automatic/Manual Start Policy
  3. Manual(manual)is Pageof from control.upload() · control.download()the Call

Upload UI

Description

Uploads begin with control.upload() after files or folders are attached. Attachments can be added through a file picker, folder picker, or drop zone (drag and drop).

Use API·Option

TargetCall·OptionDescription
File Attachcontrol.openFileDialog()File Selection Dialog
Folder Attachcontrol.directoryDialog()Folder Selection Dialog
drop zoneenableDropZone: trueAttach Allow
Folder AddaddFolder: trueFolder unit Attach Allow
Upload Startcontrol.upload()Attach Item Transfer Start

Example

html
<div id="fileControl"></div>

<button onclick="control.openFileDialog()">File Select</button>
<button onclick="control.directoryDialog()">Folder Select</button>
<button onclick="control.upload()">Upload</button>

<script>
  var control = exabyter.create({
    setElementID: '#fileControl',
    transferMode: 'upload',
    setTransferStart: { upload: 'manual' },
    setUploadURL: '/exabyter/example/upload.jsp',
    enableDropZone: true,
    addFolder: true
  });
</script>

Process

  1. Create the Control(transferMode: 'upload')
  2. openFileDialog() · directoryDialog() or drop zoneto Item Attach
  3. control.upload() Call → Slice ·Parallel Sessionto setUploadURLto Transfer

Download UI

Description

Downloads begin with control.download() after the target list is set with control.setDownloadList(). Each item includes the server download endpoint (downloadURL), a display name, and a size.

Download Item Fields

FieldTypeDescription
downloadURLstringDownload Endpoint(download.jsp?fileName=...)
displayFileNamestringListto Display File name
fileSizenumberFile Size(is)
isFolderbooleanFolder whether

Example

html
<button onclick="control.download()">Download</button>

<script>
  control.setDownloadList([
    {
      downloadURL: '/exabyter/example/download.jsp?fileName=500MB.dat',
      displayFileName: '500MB.dat',
      fileSize: 524288000,
      isFolder: false
    }
  ]);
</script>

Process

  1. Create the Control(transferMode: 'download' or 'both')
  2. setDownloadList([...]) Target List specification
  3. control.download() Call → Itemthe downloadURLfrom Slice Parallel Receive

Paths and Policies

This section covers where files are actually stored and retrieved and the policies that determine which files and how much data can be received. Storage paths are defined by server scripts, while file type, count, and size limits are configured through control options.

Storage Paths

Description

The upload storage path and download source path are defined by server scripts. For uploads, pass the storage directory to the ExabyterUpload constructor; for downloads, specify the storage root in the streaming script and read the file from it. Because these paths exist only on the server, they are not exposed to the client.

Server Configuration Points

TargetLocationValue
Upload Storage Directoryupload.jspnew ExabyterUpload(request, response, maxPostSize, directory): /storage/exabyter
Download Source Rootdownload.jspfilePath: /storage/exabyter/
Per-Transfer Subfolder (Optional)uploader.setDirectory(directory + "\\" + _transferId)_transferId Based on

Upload Storage Path (JSP)

jsp
<%@ page import="com.innorix.transfer.ExabyterUpload" %>
<%
if (request.getMethod().equals("POST")) {
    String directory   = "/storage/exabyter";       // Storage root
    int    maxPostSize  = 2147482624;       // Maximum request size (bytes)
    ExabyterUpload uploader = new ExabyterUpload(request, response, maxPostSize, directory);

    // Transfer unit  Folderthe to:
    // uploader.setDirectory(directory + "\\" + uploader.getParameter("_transferId"));

    String retval = uploader.run();         // Process slice storage
    uploader = null;
}
%>

Download Source Path (JSP)

jsp
<%
// Storage root.  is also/ both "/" Use is
//   also - C:/storage/path/data
//    - /storage/path/data
String filePath = "/storage/exabyter/";
String fileName = request.getParameter("fileName");
File file = new File(filePath + fileName);
%>

Process

  1. Upload: ExabyterUpload Create when Storage root(directory) specification → run()is Slicethe corresponding Pathto Record
  2. (Select) setDirectory() _transferId etc. Transfer unit Folder
  3. Download: of filePath(Storage root) + Request fileNameto Source File Check after

File Policies

Description

Use control options to limit the type, number, and size of files that can be received. You can specify allowed or blocked extensions, the number of files, and per-file and total size limits, while the server also limits the request body size with maxPostSize.

Options

OptionTypeDescription
allowTypestring[]Allowed extensions List (: ["zip","pdf"])
denyTypestring[]Blocked extensions List (: ["exe","bat"])
maxFileCountnumberMaximum number of attached files
maxFileSizenumberMaximum individual file size (bytes)
maxTotalSizenumberMaximum total size (bytes)
setAttachDuplicatebooleanWhether duplicate attachments of the same file are allowed

Example

html
<script>
  var control = exabyter.create({
    setElementID: '#fileControl',
    setUploadURL: '/exabyter/example/upload.jsp',
    allowType: ['zip', 'pdf', 'xlsx'],   // Allowed extensions
    denyType: null,                       // Blocked extensions(Allowand )
    maxFileCount: 100,
    maxFileSize: 21474836480,             // 20 GB
    maxTotalSize: 107374182400            // 100 GB
  });
</script>

Server side Request Size Limitis Upload from specificationdoes.

jsp
int maxPostSize = 2147482624; // Serveris Allowis Maximum Request  Size(is)
ExabyterUpload uploader = new ExabyterUpload(request, response, maxPostSize, directory);

Process

  1. allowType or denyType Policy specification
  2. maxFileCount · maxFileSize · maxTotalSize quantity·capacity specification
  3. Server maxPostSize Request Sizethe is Limit

Access Control

Description

The control sends the page session cookie with transfer requests, and server scripts identify the request origin through session and custom parameters. You can send a user identifier or arbitrary values through postData and custom and validate authorization on the server.

Options and Parameters

OptionDescription
cookieRequestto (Default document.cookie)
postDataUpload Requestto together POST is
custom
userid · UserPartUpload when User identification value

Upload is is / :

ServerDescription
typeCustom POST parameter 1
partCustom POST parameter 2
elControl element ID
_transferIdTransfer identifier

Example

Client — User identification value :

html
<script>
  var control = exabyter.create({
    setElementID: '#fileControl',
    setUploadURL: '/exabyter/example/upload.jsp',
    userid: 'user-1024',
    postData: { type: 'report', part: 'q3' }
  });
</script>

Server — Value Check after Authorization Verification:

jsp
<%
String userType = uploader.getParameter("type");   // "report"
String part     = uploader.getParameter("part");   // "q3"
String el       = uploader.getParameter("el");
// session.getId(), userType etc.to Access Control Verification
%>

Process

  1. postData·custom·userid Request origin· Valuethe Transfer
  2. controlis Session and together Server Request
  3. Serveris Session· Authorizationthe Check, required when Error Block

Expiration and Security

Description

Security is strengthened through encrypted transfer data and server-side access blocking. The control provides options for encrypting transfer data and metadata, while the server can expire or block specific requests with custom errors. Session-based access is maintained through CORS credential headers.

Options and APIs

TargetOption·APIDescription
Transfer is EncryptionuseEncrypt: trueTransfer file data with encryption
is EncryptionuseEncryptMeta: trueEncrypt metadata such as file names
Presigned URL UseisPresignedUrl: truePresigned URL
Request Block(Server)uploader.showCustomError(code, msg, detail, bool)Conditional expiration or rejection
Download Not found(Server)InnorixCustomError.set(code, msg, detail, bool)Custom errors such as 404

Example

Client — Encryption Transfer:

html
<script>
  var control = exabyter.create({
    setElementID: '#fileControl',
    setUploadURL: '/exabyter/example/upload.jsp',
    useEncrypt: true,
    useEncryptMeta: true
  });
</script>

Server — Conditionto according to Upload Reject(Expired Process ):

jsp
<%
if (uploader.getParameter("_action").equals("attachFileCompleted")
        && !isAuthorized(session)) {
    uploader.showCustomError("1500", "expired", "Authorizationis Expired.", false);
    return;
}
%>

Server — Download Targetis the when:

jsp
<%
if (!file.exists()) {
    response.setStatus(404);
    InnorixCustomError customError = new InnorixCustomError(response);
    customError.set("1016", "not Found", "file don't exist", false);
    customError.run();
    return;
}
%>

CORS (Upload·Download common):

jsp
response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin"));
response.setHeader("Access-Control-Allow-Credentials", "true");

Process

  1. Transfer Securityis if necessary useEncrypt·useEncryptMeta Encryption Transfer
  2. Serveris Session·Authorizationthe Check, Expired·Reject Conditionfrom Error return
  3. CORS Cross-originfromalso Session Access

Applying to a Web Page

This section covers the complete process of adding the control to an actual page: including resources, creating the control, connecting upload and download servers, and configuring the UI, including the view and buttons.

Create the Control

Description

exabyter.create(options) is the entry point for creating the control. Pass the target element (setElementID), server endpoints, and transfer policies as options to receive a control instance.

Key Creation Options

OptionDescription
setElementIDcontrolthe Select (: '#fileControl')
setViewTypeView (: 'ListView')
transferMode"both" · "upload" · "download"
setUploadURLUpload Receive Endpoint
monitorURLTransfer Endpoint(Select)
controlLangcontrol UI Language (: 'en', 'ko')
charsetCharacter set (Default "UTF-8")

Minimal Configuration Example

html
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <link rel="stylesheet" type="text/css" href="/exabyter/exabyter.css">
  <script src="/exabyter/exabyter.js"></script>
</head>
<body>
  <div id="fileControl"></div>
  <script>
    var control = exabyter.create({
      setElementID: '#fileControl',
      setViewType: 'ListView',
      transferMode: 'both',
      setUploadURL: '/exabyter/example/upload.jsp',
      monitorURL: '/exabyter/example/transferInfo.jsp',
      controlLang: 'en'
    });
  </script>
</body>
</html>

Process

  1. exabyter.css · exabyter.js
  2. Target Container Element
  3. exabyter.create(options) Call → control

Upload Integration

Description

Use setUploadURL to connect the server endpoint that receives upload requests and stores slices. The server processes requests with ExabyterUpload, and each request stage is identified by the _action flag.

Upload Request _action Flags

ValueStage
speedCheckMeasure transfer speed
getServerInfoCheck server information
getFileInfoCheck file information
attachFileTransfer file slices
attachFileCompletedFile transfer complete

main Request : _orig_filename(Source File name), _new_filename(Storage File name), _filesize, _start_offset · _end_offset(Slice Range), _filepath, _transferId.

Client Integration

html
<script>
  var control = exabyter.create({
    setElementID: '#fileControl',
    transferMode: 'upload',
    setUploadURL: '/exabyter/example/upload.jsp'   // ← Upload Server Connect
  });
</script>

Server (upload.jsp)

jsp
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ page import="com.innorix.transfer.ExabyterUpload" %>
<%
// CORS is(OPTIONS)is  POST whenonly Process
if (request.getMethod().equals("POST")) {
    String directory   = "/storage/exabyter";
    int    maxPostSize  = 2147482624;
    ExabyterUpload uploader = new ExabyterUpload(request, response, maxPostSize, directory);

    String action = uploader.getParameter("_action");   // Stage 
    uploader.run();                                      // Process slice storage

    if ("attachFileCompleted".equals(action)) {
        uploader.setCustomValue("_fileSize", uploader.getParameter("_filesize"));
    }
    uploader = null;
}

// CORS 
response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin"));
response.setHeader("Access-Control-Allow-Credentials", "true");
response.setHeader("Access-Control-Allow-Methods", "POST, OPTIONS");
response.setHeader("Access-Control-Allow-Headers",
    "Authorization,DNT,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type, html5");
%>

Process

  1. Client setUploadURLthe Server Path specification
  2. controlis Filethe Slice attachFile Requestthe Transfer
  3. Server uploader.run()is Slicethe Storage Pathsto Record, attachFileCompleted
  4. OPTIONS is the CORS return

Download Integration

Description

Specify download targets with setDownloadList(), and use each item's downloadURL to point to the server streaming endpoint. The server streams only the requested range (_StartOffset · _EndOffset).

Download Stream Request Parameters

Description
fileNameDownload File name
_StartOffset · _EndOffsetSlice Range(range Request)
_IsSliceTransferSlice Transfer whether
_OrigStartOffsetSource Slice Start
_IntegrityIntegrity(MD5) Request whether
_ActionDownloadStart · DownloadComplete Stage

Client Integration

html
<script>
  control.setDownloadList([
    {
      downloadURL: '/exabyter/example/download.jsp?fileName=500MB.dat',
      displayFileName: '500MB.dat',
      fileSize: 524288000,
      isFolder: false
    }
  ]);
  control.download();
</script>

Server (download.jsp, )

jsp
<%@ page contentType="application/octet-stream" trimDirectiveWhitespaces="true" %>
<%@ page import="com.innorix.transfer.InnorixCustomError" %>
<%@ page import="java.io.*" %>
<%@ page import="java.net.URLEncoder" %>
<%
// is is JSP  to  also the .
out.clear();
out = pageContext.pushBody();

String storageRoot = "/storage/exabyter/";            // Storage root ( Path )
String fileName    = request.getParameter("fileName");
// required when fileName Path is(../) Verificationthe Add.
File   file        = new File(storageRoot, fileName);

if (!file.exists()) {
    response.setStatus(404);
    InnorixCustomError customError = new InnorixCustomError(response);
    customError.set("1016", "not Found", "file don't exist", false);
    customError.run();
    return;
}

long fileLength  = file.length();
long startOffset = request.getParameter("_StartOffset") == null
        ? 0 : Long.parseLong(request.getParameter("_StartOffset"));
long endOffset   = request.getParameter("_EndOffset") == null
        ? fileLength - 1 : Long.parseLong(request.getParameter("_EndOffset"));
long contentLength = endOffset - startOffset + 1;

//  etc. ASCII File name 
String encodedName = URLEncoder.encode(fileName, "UTF-8").replace("+", "%20");

response.setHeader("Accept-Ranges", "bytes");
response.setHeader("Content-Disposition", "attachment; filename*=UTF-8''" + encodedName);
response.setHeader("Content-Length", String.valueOf(contentLength));
response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin"));
response.setHeader("Access-Control-Allow-Credentials", "true");

RandomAccessFile raf = null;
OutputStream os = null;
try {
    raf = new RandomAccessFile(file, "r");
    raf.seek(startOffset);                            // Request Rangeto  is
    os  = response.getOutputStream();
    byte[] buf = new byte[8192];
    while (contentLength > 0) {
        int read = raf.read(buf, 0, (int) Math.min(buf.length, contentLength));
        if (read == -1) break;
        os.write(buf, 0, read);
        contentLength -= read;
    }
    os.flush();
} finally {
    if (raf != null) raf.close();
    if (os != null)  os.close();
}
%>

Process

  1. setDownloadList([...]) Targetand downloadURL specification
  2. control.download() Call → controlis Range(_StartOffset·_EndOffset) Parallel Request
  3. Serveris Accept-Ranges·Content-Length corresponding Rangeonly
  4. is Fileis 404 + Error Response

UI Configuration

Description

Configure the control's view, buttons, and additional UI through options. You can enable or disable the drop zone, transfer window, QR code, progress graph, and more, and connect transfer and attachment buttons on the page to control methods.

Options

OptionValueDescription
setViewType"ListView" etc.List View
enableDropZoneboolean
showTransferWindowbooleanTransfer Show transfer window
showGraph / useSmoothGraphbooleanShow progress graph
showQrCodebooleanQR Display
showTransferStatusIconbooleanShow status icon
hideClientPathbooleanClient Path
transferWindowTitlestringTransfer Window
boxWidth · boxHeightnumbercontrol Size

Example

html
<div id="fileControl"></div>

<div style="margin-top: 20px;">
  <button onclick="control.openFileDialog()">File Select</button>
  <button onclick="control.directoryDialog()">Folder Select</button>
  <button onclick="control.upload()">Upload</button>
  <button onclick="control.download()">Download</button>
</div>

<script>
  var control = exabyter.create({
    setElementID: '#fileControl',
    setViewType: 'ListView',
    transferMode: 'both',
    setUploadURL: '/exabyter/example/upload.jsp',
    enableDropZone: true,
    showTransferWindow: true,
    showQrCode: true,
    hideClientPath: true,
    transferWindowTitle: 'Exabyter'
  });
</script>

Process

  1. setViewTypeand Display Optionto control
  2. Page to openFileDialog() · directoryDialog() · upload() · download() Connect
  3. required when boxWidth·boxHeight Size, transferWindowTitle Window adjust

Status and Results

This section explains how to display transfer progress and handle completion and failure results through callbacks. The control renders its own progress UI and notifies key stages through event callbacks.

Progress Status

Description

Transfer progress and speed are displayed in the control's transfer window and graph. Display elements can be enabled or disabled through options, and notifyReadyEvent indicates when the control is ready.

Options and Callbacks

Option·CallbackDescription
showTransferWindowShow transfer window
showGraph / alwaysShowTransferGraphShow progress graph
useSmoothGraphSmooth graph rendering
showTransferStatusIconShow status icon
notifyReadyEventControl initialization completion callback

Example

html
<script>
  var control = exabyter.create({
    setElementID: '#fileControl',
    setUploadURL: '/exabyter/example/upload.jsp',
    showTransferWindow: true,
    showGraph: true,
    useSmoothGraph: true,
    notifyReadyEvent: function () {
      // control Ready Complete —   etc.
      console.log('control ready');
    }
  });
</script>

Process

  1. Progress Display Option(showTransferWindow·showGraph etc.)to UI
  2. notifyReadyEventfrom Ready Complete Check after Allow
  3. Transfer controlis Progress·Speedthe Automatic Refresh

Completion Results

Description

When uploads or downloads finish, uploadCompletedEvent and downloadCompletedEvent are called respectively. Use the result passed to the callback to identify completed files and transfer IDs and run follow-up logic such as recording the transfer or refreshing the UI.

Completion Callbacks

Callbackwhen
uploadCompletedEventAll Uploads Complete
downloadCompletedEventAll Downloads Complete

Example

html
<script>
  var control = exabyter.create({
    setElementID: '#fileControl',
    setUploadURL: '/exabyter/example/upload.jsp',
    uploadCompletedEvent: function (result) {
      // Upload Complete after Process (: Serverto  etc., List Refresh)
      console.log('upload completed', result);
    },
    downloadCompletedEvent: function (result) {
      console.log('download completed', result);
    }
  });
</script>

Serveris Complete Stagefrom Valuethe Resultto can.

jsp
<%
if ("attachFileCompleted".equals(uploader.getParameter("_action"))) {
    uploader.setCustomValue("_fileSize", uploader.getParameter("_filesize"));
}
%>

Process

  1. Create Optionto uploadCompletedEvent · downloadCompletedEvent etc.
  2. Transfer Complete when Callback Result Receive
  3. Serveris setCustomValue Valuethe after Process

Result Events

Description

The control emits start, progress, completion, cancellation, and error events throughout the transfer lifecycle. In addition to the completion callbacks above, you can handle start, progress, cancellation, and error events for each direction.

Event List

DirectionStartProgressCompleteCancelError
UploaduploadStartuploadProgressuploadCompleteuploadCanceluploadError
DownloaddownloadStartdownloadProgressdownloadCompletedownloadCanceldownloadError
Transfer(common)transferCompletetransferCanceltransferError

main Complete·Ready whenis Create Optionof Callback(uploadCompletedEvent · downloadCompletedEvent · notifyReadyEvent)to Connectdoes.

Example

html
<script>
  var control = exabyter.create({
    setElementID: '#fileControl',
    setUploadURL: '/exabyter/example/upload.jsp',
    notifyReadyEvent: function () { /* Ready Complete */ },
    uploadCompletedEvent: function (result) { /* Upload Complete */ },
    downloadCompletedEvent: function (result) { /* Download Complete */ }
  });
</script>

Process

  1. Ready·Complete whenis Create Option Callbackto Connect
  2. Start·Progress·Cancel whenis if necessary corresponding Direction Eventthe together Process
  3. Event is Result ·Record Refresh

Error Handling

Description

Transfer failures are reported through upload and download error events, and the server returns custom error codes describing the cause. The control recovers from temporary errors according to its retry and automatic recovery policies.

Options and APIs

TargetOption·APIDescription
Upload Error EventuploadErrorUpload Failure
Download Error EventdownloadErrorDownload Failure
RetryretryCount (Default 5)Failure when Retry
RetryretryDelay (Default 3)Retry when
Maximum Error AllowmaxErrorCountand when Transfer Interrupted
Server Custom ErrorshowCustomError(code, msg, detail, bool) · InnorixCustomError.set(...)Failure

Example

Server — Upload Condition Error:

jsp
<%
if (invalidRequest) {
    uploader.showCustomError("1003", "invalid request", "Requestis  .", false);
    return;
}
%>

Server — Download File Not found(404):

jsp
<%
if (!file.exists()) {
    response.setStatus(404);
    InnorixCustomError customError = new InnorixCustomError(response);
    customError.set("1016", "not Found", "file don't exist", false);
    customError.run();
    return;
}
%>

Client — Retry Policy:

html
<script>
  var control = exabyter.create({
    setElementID: '#fileControl',
    setUploadURL: '/exabyter/example/upload.jsp',
    retryCount: 5,
    retryDelay: 3,
    maxErrorCount: 9999
  });
</script>

Process

  1. retryCount · retryDelay Temporary Errorof Automatic Retry Policy Configure
  2. Serveris Failure Conditionfrom Error the return
  3. Retryalso Error Event , maxErrorCount and when Interrupted

Large-File Transfer

This section covers slice splitting and parallel sessions, interrupted-transfer recovery, automatic retries, and integrity verification for reliably transferring files ranging from several GB to tens of GB. Most of these features are enabled and configured through options.

Large-File Transfer

Description

The control splits files into slices (chunks) and transfers them in parallel across multiple sessions, increasing throughput in high-speed mode. Tune slice size and session count for your network environment.

Options

OptionDefaultDescription
sliceSize2097152 (2 MB)Slice Size(is)
uploadSliceSize · downloadSliceSize0(=sliceSize)Direction Slice Size
sessionCount15Parallel Session
uploadSessionCount · downloadSessionCount0(=sessionCount)Direction Session
highSpeedMode / isHighSpeedtrueHigh-speed Transfer
largeAcceleratorfalseLarge-file is

Serveris Upload Request Sizethe maxPostSize Allow does.

Example

html
<script>
  var control = exabyter.create({
    setElementID: '#fileControl',
    setUploadURL: '/exabyter/example/upload.jsp',
    isHighSpeed: true,
    sliceSize: 2097152,          // 2 MB Slice
    uploadSessionCount: 16,      // Parallel Session 16
    downloadSessionCount: 16
  });
</script>

Process

  1. Filethe sliceSize unit Slice
  2. sessionCount(Direction Session )only Parallel Slice Transfer
  3. High-speed ·is Optionto Process , Server maxPostSize Request Size

Interrupted Transfer Recovery

Description

Even if a transfer is interrupted by a network disconnection or closing the window, it can resume from the point after the slices already stored. Uploads resume based on the slice offset (_start_offset), while downloads resume the remaining range through range requests (Accept-Ranges). Duplicate-handling policies determine whether to resume, overwrite, and so on.

Options

OptionValueDescription
resumeTypeoverwrite · relay · nosend · numbering · confirmUpload
uploadDuplicateboolean / PolicyUpload Duplicate Process
downloadDuplicateresume etc.Download Duplicate·is Process
resumeConditionbooleanCondition Use
attachIncompleteFilesbooleanReattach Incomplete Files
autoRecoverybooleanAutomatic Recovery
enableAutoReattachbooleanAutomatic Reattachment (Reconnection)

Example

html
<script>
  var control = exabyter.create({
    setElementID: '#fileControl',
    setUploadURL: '/exabyter/example/upload.jsp',
    resumeType: 'relay',           // Storage point is
    downloadDuplicate: 'resume',
    autoRecovery: true,
    attachIncompleteFiles: true,
    enableAutoReattach: true
  });
</script>

Download Serveris range Requestthe must support does(Slice Rangeonly ).

jsp
<%
response.setHeader("Accept-Ranges", "bytes");
long contentLength = endOffset - startOffset + 1;   // Remaining Range
response.setHeader("Content-Length", String.valueOf(contentLength));
if (startOffset != 0) in.skip(startOffset);          // Storage point isafter
%>

Process

  1. Transfer Slice Complete pointthe
  2. Interrupted after when last Complete Slice isafter Transfer(_start_offset / range Request)
  3. resumeType · downloadDuplicate Policyto is·overwrite

Automatic Retry

Description

Slices affected by temporary network errors are automatically retried according to the configured count and interval. If a retry succeeds, the transfer continues; if the allowed error count is exceeded, the transfer stops.

Options

OptionDefaultDescription
retryCount5Slice Failure when Retry
retryDelay3Retry ()
maxErrorCount9999Cumulative Allow Error
autoRecoverytrueAutomatic Recovery Use
timeout.minSeconds60Minimum ()
timeout.bytes / timeout.seconds0is calculation

Example

html
<script>
  var control = exabyter.create({
    setElementID: '#fileControl',
    setUploadURL: '/exabyter/example/upload.jsp',
    retryCount: 5,
    retryDelay: 3,
    maxErrorCount: 9999,
    autoRecovery: true,
    timeout: { minSeconds: 60, bytes: 0, seconds: 0 }
  });
</script>

Process

  1. Slice Transfer Failure when retryDelay to retryCountonly Retry
  2. Retry when Transfer , timeout Based onto Response
  3. Cumulative Erroris maxErrorCountthe if exceeded Transfer Interrupted·Error

Integrity Verification

Description

After transfer, slice-level hashes verify that the file arrived without corruption. When download integrity verification is enabled, the control requests an MD5 for each range from the server, and the server returns the MD5 for the corresponding slice for comparison.

Options and APIs

TargetOption·APIDescription
Download IntegritydownloadIntegrity: trueDownload Integrity Verification Use
VerificationsetVerification'disable' etc. Verification
Integrity Request (Server Parameter)_Integrity=trueMD5 Request
Slice MD5 (Server)Integrity.getMD5FromFileSlice(path, start, end)Range MD5 calculation

Example

Client — Integrity Verification Use:

html
<script>
  var control = exabyter.create({
    setElementID: '#fileControl',
    setUploadURL: '/exabyter/example/upload.jsp',
    downloadIntegrity: true,
    setVerification: 'enable'
  });
</script>

Server — Integrity Request when Slice MD5 return:

jsp
<%@ page import="com.innorix.integrity.Integrity" %>
<%
if ("true".equalsIgnoreCase(request.getParameter("_Integrity"))) {
    long start = Long.parseLong(request.getParameter("_StartOffset"));
    long end   = Long.parseLong(request.getParameter("_EndOffset"));

    Integrity integrity = new Integrity();
    String md5 = integrity.getMD5FromFileSlice(filePath + fileName, start, end);

    response.setStatus(200);
    response.getWriter().write(md5);
    response.getWriter().flush();
    response.getWriter().close();
    return;
}
%>

Process

  1. downloadIntegrity · setVerificationto Verification Use
  2. controlis Range _Integrity=true Requestto Server MD5
  3. Serveris getMD5FromFileSlice calculation MD5and Receive Slicethe compare corruption whether