claroline/claroline/inc/lib/file.lib.php File Reference

Go to the source code of this file.

Namespaces

namespace  KERNEL

Functions

 file_upload_failed ($file)
 get_file_upload_errno ($file)
 get_file_upload_error_message ($file)
 get_file_upload_errstring_from_errno ($errorLevel)
 get_file_extension ($fileName)
 get_mime_on_ext ($fileName)
 claro_send_file ($path, $name= '', $charset=null)
 claro_send_stream ($stream, $name, $mimeType=null, $charset=null)
 secure_file_path ($path)
 claro_readfile ($path, $retbytes=true)
 is_download_url_encoded ($str)
 download_url_encode ($str)
 download_url_decode ($str)
 claro_get_file_download_url ($file, $context=null)
 replace_dangerous_char ($string, $strict= 'loose')

Function Documentation

claro_get_file_download_url ( file,
context = null 
)

Get the url to download the file at the given file path

Parameters:
string $file path to the file
array $context
Returns:
string url to the file

Definition at line 491 of file file.lib.php.

claro_readfile ( path,
retbytes = true 
)

Read a file from the file system and echo it

Workaround for the readfile bug in PHP 5.0.4 and with host where PHP readfile is deactivated

Parameters:
string $path file path
boolean $retbytes return file length (default true)
Returns:
int file length if $retbytes boolean true on success if not $retbytes boolean false on failure set claro_failure on failure
Deprecated:
since Claroline 1.9 and PHP 5.1

Definition at line 389 of file file.lib.php.

claro_send_file ( path,
name = '',
charset = null 
)

Send a file over HTTP

Parameters:
string $path file path
string $name file name to force (optional)
Returns:
true on success, false if file not found or file empty, set a claro_failure if file not found

Definition at line 246 of file file.lib.php.

claro_send_stream ( stream,
name,
mimeType = null,
charset = null 
)

Send a stream over HTTP

Parameters:
string $stream file stream
string $name file name to force (optional)
string $mimeType mime type of the stream if none given, the function will try to guess it from $name
string $charset character encoding of the strem, if none given the function will use the encoding of the current page
Returns:
number of octets sent
Since:
Claroline 1.9.5

Definition at line 307 of file file.lib.php.

download_url_decode ( str  ) 

Decode encoded relative file path

Parameters:
string $str
Returns:
string

Definition at line 472 of file file.lib.php.

download_url_encode ( str  ) 

WARNING : DO NOT USE IN Url OBJET : ALREADY URLENCODED USE BASE64_ENCODE INSTEAD ! Encode course relative file path to use with backend/download

Parameters:
string file relative path
Returns:
string

Definition at line 454 of file file.lib.php.

file_upload_failed ( file  ) 

Definition at line 18 of file file.lib.php.

get_file_extension ( fileName  ) 

Extract the extention of the filename

Parameters:
string $fileName name of the file
Returns:
string extension

Definition at line 87 of file file.lib.php.

get_file_upload_errno ( file  ) 

Definition at line 23 of file file.lib.php.

get_file_upload_error_message ( file  ) 

Definition at line 28 of file file.lib.php.

get_file_upload_errstring_from_errno ( errorLevel  ) 

Definition at line 33 of file file.lib.php.

get_mime_on_ext ( fileName  ) 

Get file MIME type from file name based on extension

Parameters:
string $fileName name of the file
Returns:
string file MIME type

Definition at line 100 of file file.lib.php.

is_download_url_encoded ( str  ) 

Check if a relative path is encoded or not

Parameters:
string $str
Returns:
boolean

Definition at line 441 of file file.lib.php.

replace_dangerous_char ( string,
strict = 'loose' 
)

replaces some dangerous character in a file name This function is broken !

Parameters:
string $string
string $strict (optional) removes also scores and simple quotes
Returns:
string : the string cleaned of dangerous character
Todo:
function broken !

Definition at line 529 of file file.lib.php.

secure_file_path ( path  ) 

Remove /.. ../ from file path

Parameters:
string $path file path
Returns:
string, clean file path

Definition at line 359 of file file.lib.php.

Generated on Tue Jun 8 12:28:37 2010 for Claroline API by  doxygen 1.6.3