Function __global->_get_upload_url
Definitions
sources/uploads.php
- Converts an uploaded file into a URL, by moving it to an appropriate place.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
- Returns: array
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $member_id | MEMBER | No | No | required parameter | N/A | N/A | Member ID to check permissions with |
| $attach_name | ID_TEXT | No | No | required parameter | N/A | N/A | The name of the HTTP file parameter storing the upload (if '', then no HTTP file parameter). No file necessarily is uploaded under this. |
| $upload_folder | ID_TEXT | No | No | required parameter | N/A | N/A | The folder name where we will put this upload |
| $upload_folder_full | PATH | No | No | required parameter | N/A | N/A | Full folder path |
| $enforce_type | integer | No | No | 15 | N/A | N/A | The type of upload it is (bitmask, from CMS_UPLOAD_* constants) |
| $obfuscate | integer | No | No | 0 | N/A | N/A | Whether to obfuscate file names so the URLs can not be guessed/derived (a OBFUSCATE_* constant) |
| $accept_errors | boolean | No | No | False | N/A | N/A | Whether to accept upload errors |
| $filename | ?string | No | No | Null | N/A | N/A | Filename to use (null: choose one) |
Returns
- A pair: the URL and the filename
- Type: array
- Set: N/A
- Range: N/A
Preview
Code (PHP)
/**
* Converts an uploaded file into a URL, by moving it to an appropriate place.
*
* @param MEMBER $member_id Member ID to check permissions with
* @param 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.
* @param ID_TEXT $upload_folder The folder name where we will put this upload
* @param PATH $upload_folder_full Full folder path
* @param integer $enforce_type The type of upload it is (bitmask, from CMS_UPLOAD_* constants)
* @param integer $obfuscate Whether to obfuscate file names so the URLs can not be guessed/derived (a OBFUSCATE_* constant)
* @param boolean $accept_errors Whether to accept upload errors
* @param ?string $filename Filename to use (null: choose one)
* @return array A pair: the URL and the filename
*/
function _get_upload_url(int $member_id, string $attach_name, string $upload_folder, string $upload_folder_full, int $enforce_type = 15, int $obfuscate = 0, bool $accept_errors = false, ?string $filename = null) : array
* Converts an uploaded file into a URL, by moving it to an appropriate place.
*
* @param MEMBER $member_id Member ID to check permissions with
* @param 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.
* @param ID_TEXT $upload_folder The folder name where we will put this upload
* @param PATH $upload_folder_full Full folder path
* @param integer $enforce_type The type of upload it is (bitmask, from CMS_UPLOAD_* constants)
* @param integer $obfuscate Whether to obfuscate file names so the URLs can not be guessed/derived (a OBFUSCATE_* constant)
* @param boolean $accept_errors Whether to accept upload errors
* @param ?string $filename Filename to use (null: choose one)
* @return array A pair: the URL and the filename
*/
function _get_upload_url(int $member_id, string $attach_name, string $upload_folder, string $upload_folder_full, int $enforce_type = 15, int $obfuscate = 0, bool $accept_errors = false, ?string $filename = null) : array

