It should be something like this IMHO:
```php
// Prapare import directory for current upload to avoid naming collisions
$tempDir = sys_get_temp_dir();
// there should be some check if directory exists...
// don't mess system tmp dir, put everything from SAPI client into one folder
$sapiClientTempDir = $tempDir . '/sapi-php-client'; 
mkdir($sapiClientTempDir);
$currentUploadDir = $sapiClientTempDir . '/' . uniqid('file-upload')
mkdir(gzFileName);

// gzip file and preserve it's base name
$gzFilePath = $currentUploadDir . '/'. basename($filePath) . '.gz';
exec(sprintf("gzip -d %s > %s", escapeshellarg($filePath), escapeshellarg($gzFilePath))); 

// cleanup - must be done on success but also on failure
rmrf($sapiClientImportDir); // this function does not exists, just example:)
```
I recommend to use http://symfony.com/doc/current/components/filesystem.html for file system operations, it has much better error handling and offers some useful method for working with directories e.g. http://symfony.com/doc/current/components/filesystem.html#remove will remove directory and it's content