Handles file uploads in chunks using the JS File API and XMLHttpRequest
This is the code documentation for the SproutCMS project
Search documentation |
class FileUploadControllerHandles file uploads in chunks using the JS File API and XMLHttpRequest
Extending this class<?php
/**
* New class description goes here
*
* @author Your Name, 2026-09-15
**/
class NewClassName extends FileUploadController {
/**
* Stitch together the uploaded file from multiple chunks
**/
private function stitchChunks (string $dest_filename, string $code, string $num_chunks) {
// Method code goes here
}
/**
* Clean up any left-over chunks
**/
protected function cleanupChunks (string $code, int $num_chunks) {
// Method code goes here
}
/**
* Cancel an upload - delete temporary files.
*
* May receive two different variations on the provided POST data:
* [result][tmp_file] Whole file was uploaded
* [partial_upload][code] Only some chunks of the file have been uploaded
**/
public function uploadCancel () {
// Method code goes here
}
/**
* Returns the form for updating a file which has been uploaded
**/
public function uploadForm () {
// Method code goes here
}
/**
* Perform a file extension check.
* To be implemented by subclasses
**/
public function fileExtCheck ($temp_path) {
// Method code goes here
}
/**
* Save a single chunk of a multi-part file upload
**/
public function uploadChunk () {
// Method code goes here
}
/**
* Stitch together uploaded chunks into an actual file
*
* Outputs a JSON response.
* The field "success" will be checked (= 1) to determine success.
* On error, the field "message" will be used as an error message.
* Other keys provided are passed to the ajaxDragdropForm method.
**/
public function uploadDone () {
// Method code goes here
}
public function clearSession () {
// Method code goes here
}
/**
* Signals that the user would like to upload a file
* Perform basic sanity checks and establish (or reset) their session state
**/
public function uploadBegin () {
// Method code goes here
}
/**
* Perform a size check on a completed upload (after chunks have been stitched).
* To be implemented by subclasses
**/
public function fileSizeCheck (string $temp_path) {
// Method code goes here
}
/**
* Perform a size check on a set of uploaded chunks.
* To be implemented by subclasses
**/
public function chunkSizeCheck () {
// Method code goes here
}
/**
* Perform additional checks (beyond the checks already in {@see FileUploadController::uploadChunk}) on an uploaded chunk.
* To be implemented by subclasses
**/
public function extraChunkCheck () {
// Method code goes here
}
/**
* Checks POSTed code matched the expected format
**/
protected function validateCode () {
// Method code goes here
}
/**
* Creates a session record for a new file upload, and configures its initial state
**/
protected function startSession () {
// Method code goes here
}
/**
* Gets the session data associated with a file upload
**/
public function session () {
// Method code goes here
}
}
?>
|
| Powered by Pelzini, version 0.9.0 |
Documentation is made available under the
GNU Free Documentation License 1.2. Generated: Tuesday, 15th September, 2026 at 10:26 am |
|