function drupal_tempnam

×

Error message

User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
cis7 file.inc drupal_tempnam($directory, $prefix)
cle7 file.inc drupal_tempnam($directory, $prefix)
elmsmedia7 file.inc drupal_tempnam($directory, $prefix)
icor7 file.inc drupal_tempnam($directory, $prefix)
meedjum_blog7 file.inc drupal_tempnam($directory, $prefix)
mooc7 file.inc drupal_tempnam($directory, $prefix)

Creates a file with a unique filename in the specified directory.

PHP's tempnam() does not return a URI like we want. This function will return a URI if given a URI, or it will return a filepath if given a filepath.

Compatibility: normal paths and stream wrappers.

Parameters

$directory: The directory where the temporary filename will be created.

$prefix: The prefix of the generated temporary filename. Note: Windows uses only the first three characters of prefix.

Return value

The new temporary filename, or FALSE on failure.

See also

tempnam()

http://drupal.org/node/515192

Related topics

21 calls to drupal_tempnam()
advagg_save_data in sites/all/modules/ulmus/advagg/advagg.missing.inc
Save data to a file.
backup_file::temporary_file in sites/all/modules/ulmus/backup_migrate/includes/files.inc
Get a temporary file name with path.
BaconmockupProvider::generateImage in sites/all/modules/ulmus/devel_image_provider/plugins/devel_image_provider/provider/BaconmockupProvider.class.php
Image generation handler.
boost_write_file in sites/all/modules/ulmus/boost/boost.module
Write to a file. Ensures write is atomic via rename operation.
ctools_stylizer_image_processor::command_slice in sites/all/modules/ulmus/ctools/includes/stylizer.inc
Take a slice out of the current workspace and save it as an image.

... See full list

File

includes/file.inc, line 2424
API for handling file uploads and server file management.

Code

function drupal_tempnam($directory, $prefix) {
  $scheme = file_uri_scheme($directory);

  if ($scheme && file_stream_wrapper_valid_scheme($scheme)) {
    $wrapper = file_stream_wrapper_get_instance_by_scheme($scheme);

    if ($filename = tempnam($wrapper->getDirectoryPath(), $prefix)) {
      return $scheme . '://' . drupal_basename($filename);
    }
    else {
      return FALSE;
    }
  }
  else {
    // Handle as a normal tempnam() call.
    return tempnam($directory, $prefix);
  }
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.