API - XOOPS 2.5.11 Beta 2
By monxoops.fr
ajaxfineupload.php File Reference

Functions

 get_request_method ()
 

Variables

 if (isset( $_POST[ 'Authorization']))
 
$xoopsLogger activated = false
 
 $assert
 
 $claims = TokenReader::fromRequest('fineuploader', 'Authorization', $assert)
 
 $handler = (property_exists($claims, 'handler')) ? $claims->handler : ''
 
 $moddir = (property_exists($claims, 'moddir')) ? $claims->moddir : ''
 
if($handler===''|| $moddir==='') $className = $handler
 
if(false===strpos($handler, '\\')) $uploader = new $className($claims)
 
 $method = get_request_method()
 
if( $method==="POST") elseif($method=="DELETE") else
 

Function Documentation

◆ get_request_method()

get_request_method ( )

This will retrieve the "intended" request method. Normally, this is the actual method of the request. Sometimes, though, the intended request method must be hidden in the parameters of the request. For example, when attempting to delete a file using a POST request. In that case, "DELETE" will be sent along with the request in a "_method" parameter.

Returns
string

Variable Documentation

◆ $assert

$assert
Initial value:
= array(
'aud' => basename(__FILE__),
'uid' => $xoopsUser instanceof \XoopsUser ? $xoopsUser->id() : 0,
)
Definition: user.php:28
$xoopsUser
Definition: common.php:192

Get our expected claims from the JSON Web Token.

This is the list of claims which should be included:

aud audience (asserted as our php script name) cat category id the user has chosen and is authorized for uid user id (asserted as the session specified user) handler handler class moddir module directory for handler

We will assert that aud and uid agree with our expectations (for security)

◆ $claims

$claims = TokenReader::fromRequest('fineuploader', 'Authorization', $assert)

◆ $className

if ( $handler===''||$moddir==='') $className = $handler

The handler claim can be specified as either:

  • a fully qualified and autoloading namespaced name,
  • a legacy handler name

◆ $handler

$handler = (property_exists($claims, 'handler')) ? $claims->handler : ''

◆ $method

$method = get_request_method()

◆ $moddir

$moddir = (property_exists($claims, 'moddir')) ? $claims->moddir : ''

◆ $uploader

if (false===strpos( $handler, '\\')) $uploader = new $className($claims)

◆ activated

$xoopsLogger activated = false

◆ else

if($method==="POST") elseif ( $method=="DELETE") else
Initial value:
{
header("HTTP/1.0 405 Method Not Allowed")

◆ if

if(isset($_POST['Authorization'])) ( isset( $_POST[ 'Authorization'])  )

PHP Server-Side Example for Fine Uploader (traditional endpoint handler). Maintained by Widen Enterprises.

This example:

  • handles chunked and non-chunked requests
  • supports the concurrent chunking feature
  • assumes all upload requests are multipart encoded
  • supports the delete file feature

Follow these steps to get up and running with Fine Uploader in a PHP environment:

  1. Setup your client-side code, as documented on http://docs.fineuploader.com.
  2. Copy this file and handler.php to your server.
  3. Ensure your php.ini file contains appropriate values for max_input_time, upload_max_filesize and post_max_size.
  4. Ensure your "chunks" and "files" folders exist and are writable. "chunks" is only needed if you have enabled the chunking feature client-side.
  5. If you have chunking enabled in Fine Uploader, you MUST set a value for the chunking.success.endpoint option. This will be called by Fine Uploader when all chunks for a file have been successfully uploaded, triggering the PHP server to combine all parts into one file. This is particularly useful for the concurrent chunking feature, but is now required in all cases if you are making use of this PHP example.

@license MIT License (MIT)