get_url (line 100)
Get URLs generated according to the specified information. It can also generate a thumbnail if required. It first tries attached upload, then URL, then fails.
array
get_url
(ID_TEXT $specify_name, ID_TEXT $attach_name, ID_TEXT $upload_folder, [integer $obfuscate = 0], [integer $enforce_type = 0], [boolean $make_thumbnail = false], [ID_TEXT $thumb_specify_name = ''], [ID_TEXT $thumb_attach_name = ''], [boolean $copy_to_server = false], [boolean $accept_errors = false], [boolean $should_get_something = false])
-
ID_TEXT
$specify_name: The name of the POST parameter storing the URL (if '', then no POST parameter). Parameter value may be blank.
-
ID_TEXT
$attach_name: The name of the HTTP file parameter storing the upload (if '', then no HTTP file parameter). No file necessarily is uploaded under this.
-
ID_TEXT
$upload_folder: The folder name in uploads/ where we will put this upload
-
integer
$obfuscate: Whether to obfuscate file names so the URLs can not be guessed/derived (0=do not, 1=do, 2=make extension .dat as well, 3=only obfuscate if we need to)
-
integer
$enforce_type: The type of upload it is (from an OCP_UPLOAD_* constant)
-
boolean
$make_thumbnail: Make a thumbnail (this only makes sense, if it is an image)
-
ID_TEXT
$thumb_specify_name: The name of the POST parameter storing the thumb URL. As before
-
ID_TEXT
$thumb_attach_name: The name of the HTTP file parameter storing the thumb upload. As before
-
boolean
$copy_to_server: Whether to copy a URL (if a URL) to the server, and return a local reference
-
boolean
$accept_errors: Whether to accept upload errors
-
boolean
$should_get_something: Whether to give a (deferred?) error if no file was given at all
init__uploads (line 24)
Standard code module initialisation function.
void
init__uploads
()
is_swf_upload (line 44)
Find whether an swfupload upload has just happened, and optionally simulate as if it were a normal upload (although 'is_uploaded_file'/'move_uploaded_file' would not work).
boolean
is_swf_upload
([boolean $fake_prepopulation = false])
-
boolean
$fake_prepopulation: Simulate population of the $_FILES array.
_check_enforcement_of_type (line 531)
Ensures a given filename is of the right file extension for the desired file type.
void
_check_enforcement_of_type
(string $file, integer $enforce_type, [boolean $accept_errors = false])
-
string
$file: The filename.
-
integer
$enforce_type: The type of upload it is (from an OCP_UPLOAD_* constant)
-
boolean
$accept_errors: Whether to accept upload errors
_get_specify_url (line 466)
Filters specified URLs to make sure we're really allowed to access them.
array
_get_specify_url
(ID_TEXT $specify_name, ID_TEXT $upload_folder, [integer $enforce_type = 0], [boolean $accept_errors = false])
-
ID_TEXT
$specify_name: The name of the POST parameter storing the URL (if '', then no POST parameter). Parameter value may be blank.
-
ID_TEXT
$upload_folder: The folder name in uploads/ where we will put this upload
-
integer
$enforce_type: The type of upload it is (from an OCP_UPLOAD_* constant)
-
boolean
$accept_errors: Whether to accept upload errors
_get_upload_url (line 570)
Converts an uploaded file into a URL, by moving it to an appropriate place.
array
_get_upload_url
(ID_TEXT $attach_name, ID_TEXT $upload_folder, [integer $enforce_type = 0], [integer $obfuscate = 0], [boolean $accept_errors = false])
-
ID_TEXT
$attach_name: The name of the HTTP file parameter storing the upload (if '', then no HTTP file parameter). No file necessarily is uploaded under this.
-
ID_TEXT
$upload_folder: The folder name in uploads/ where we will put this upload
-
integer
$enforce_type: The type of upload it is (from an OCP_UPLOAD_* constant)
-
integer
$obfuscate: Whether to obfuscate file names so the URLs can not be guessed/derived (0=do not, 1=do, 2=make extension .dat as well)
-
boolean
$accept_errors: Whether to accept upload errors