API Reference


Use this method to trash file(s) from the system.

You must have the media.trashFile permission to call this service on media owned by another user (including the public user). Otherwise you may only trash your own media; you must be logged in to do so. If you do not have permission to trash any of the media specified this function will immediately abort and some media that you specified may be left untrashed.

This method removes any cached data for media.getFileInfo ONLY if media.getFileInfo is called with no user ID and returnComments set to false. If media.getFileInfo is called with a user ID or returnComments set to true then stale data may be returned until the cache is refreshed. This will occur automatically after a few minutes.


void media.trashFile ( mixed id, boolean recursive = true )


NameTypeRequiredDefault valueDescription
idmixedRequirednoneThis can be a single media ID or an array of valid media IDs.
recursivebooleanOptionaltrueThis optional argument allows you to trash all recursive children of the specified media ID(s). For example this will trash the specified media ID along with all if its comments. Possible values are 0 => false and 1 => true.


The response returned upon success of the request.

NameTypeDescriptionDefault Values
resultINT1 will be returned upon a successful request and response.1

Sample Response

Sample REST Response
<?xml version="1.0" encoding="UTF-8"?>
Sample JSON Response
    "status": true,
    "result": 1

Code examples


Be the first to comment on trashFile.

Add a Comment

  • captcha