New method to access files.

This commit is contained in:
James Cole 2016-02-23 16:15:37 +01:00
parent 55ab39ca55
commit 6387114a18

View File

@ -11,6 +11,8 @@ use League\Csv\Reader;
use Log;
use ReflectionException;
use Session;
use SplFileObject;
use Storage;
/**
* Class Wizard
@ -159,12 +161,13 @@ class Wizard implements WizardInterface
{
$time = str_replace(' ', '-', microtime());
$fileName = 'csv-upload-' . Auth::user()->id . '-' . $time . '.csv.encrypted';
$fullPath = storage_path('upload') . DIRECTORY_SEPARATOR . $fileName;
$content = file_get_contents($path);
$disk = Storage::disk('upload');
$file = new SplFileObject($path, 'r');
$content = $file->fread($file->getSize());
$contentEncrypted = Crypt::encrypt($content);
file_put_contents($fullPath, $contentEncrypted);
$disk->put($fileName, $contentEncrypted);
return $fullPath;
return $fileName;
}