Function __global->delete_upload
Definitions
sources/files2.php
- Delete an uploaded file from disk, if it's URL has changed (i.e. it's been replaced, leaving a redundant disk file).This MUST be run before the edit/delete operation, as it scans for the existing value to know what is changing.
- Visibility: public
- Is abstract?: No
- Is static?: No
- Is final?: No
Parameters
| Name | Type | Passed by reference? | Variadic? | Default | Set | Range | Description |
|---|---|---|---|---|---|---|---|
| $upload_path | string | No | No | required parameter | N/A | N/A | The path to the upload directory |
| $table | ID_TEXT | No | No | required parameter | N/A | N/A | The table name |
| $field | ID_TEXT | No | No | required parameter | N/A | N/A | The table field name |
| $id_field | mixed | No | No | required parameter | N/A | N/A | The table ID field name, or a map array |
| $id | mixed | No | No | required parameter | N/A | N/A | The table ID |
| $new_url | ?string | No | No | Null | N/A | N/A | The new URL to use (null: deleting without replacing: no change check) |
Preview
Code (PHP)
/**
* Delete an uploaded file from disk, if it's URL has changed (i.e. it's been replaced, leaving a redundant disk file).This MUST be run before the edit/delete operation, as it scans for the existing value to know what is changing.
*
* @param string $upload_path The path to the upload directory
* @param ID_TEXT $table The table name
* @param ID_TEXT $field The table field name
* @param mixed $id_field The table ID field name, or a map array
* @param mixed $id The table ID
* @param ?string $new_url The new URL to use (null: deleting without replacing: no change check)
*/
function delete_upload(string $upload_path, string $table, string $field, $id_field, $id, ?string $new_url = null)
* Delete an uploaded file from disk, if it's URL has changed (i.e. it's been replaced, leaving a redundant disk file).This MUST be run before the edit/delete operation, as it scans for the existing value to know what is changing.
*
* @param string $upload_path The path to the upload directory
* @param ID_TEXT $table The table name
* @param ID_TEXT $field The table field name
* @param mixed $id_field The table ID field name, or a map array
* @param mixed $id The table ID
* @param ?string $new_url The new URL to use (null: deleting without replacing: no change check)
*/
function delete_upload(string $upload_path, string $table, string $field, $id_field, $id, ?string $new_url = null)

