You are here

function devel_generate_textfile in Devel 7

Private function for generating a random text file.

1 call to devel_generate_textfile()
_file_devel_generate in devel_generate/file.devel_generate.inc

File

devel_generate/file.devel_generate.inc, line 54

Code

function devel_generate_textfile($filesize = 1024) {
  if ($tmp_file = drupal_tempnam('temporary://', 'filefield_')) {
    $destination = $tmp_file . '.txt';
    file_unmanaged_move($tmp_file, $destination);
    $fp = fopen($destination, 'w');
    fwrite($fp, str_repeat('01', $filesize / 2));
    fclose($fp);
    return $destination;
  }
}