Skip to content

Instantly share code, notes, and snippets.

@standa
Created June 29, 2015 09:45
Show Gist options
  • Save standa/2b7fc215cbc5f0ae1dfe to your computer and use it in GitHub Desktop.
Save standa/2b7fc215cbc5f0ae1dfe to your computer and use it in GitHub Desktop.
How to create a 20 MB file quickly in PHP
<?php
/** @link https://github.com/google/google-api-php-client/blob/master/examples/fileupload.php */
/************************************************
We'll setup an empty 20MB file to upload.
************************************************/
DEFINE("TESTFILE", 'testfile.txt');
if (!file_exists(TESTFILE)) {
$fh = fopen(TESTFILE, 'w');
fseek($fh, 1024*1024*20);
fwrite($fh, "!", 1);
fclose($fh);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment