You are here

function _services_file_check_destination_uri in Services 7.3

Sanitizes a user-input file URI.

Parameters

string $uri: The file URI to sanitize, including the extension, name, path and scheme.

Return value

string A safe destination URI to save the file.

1 call to _services_file_check_destination_uri()
_file_resource_create in resources/file_resource.inc
Adds a new file and returns the fid.

File

resources/file_resource.inc, line 417
File resource.

Code

function _services_file_check_destination_uri($uri) {
  $scheme = strstr($uri, '://', TRUE);
  $path = $scheme ? substr($uri, strlen("{$scheme}://")) : $uri;

  // Sanitize the file extension, name, path and scheme provided by the user.
  $scheme = _services_file_check_destination_scheme($scheme);
  $path = _services_file_check_destination($path);
  return "{$scheme}://{$path}";
}