Skip to content
Snippets Groups Projects
Commit 9643dd05 authored by Matthias Adrowski's avatar Matthias Adrowski
Browse files

[TASK] Create temp folder in JobApplication if not existing

parent a4770c8d
No related branches found
No related tags found
No related merge requests found
......@@ -105,7 +105,11 @@ class UploadController extends AbstractAjaxController {
str_replace(' ', '_', trim($pathInfo['filename'] . '.' . strtolower($pathInfo['extension'])))
)
);
$folder = $storage->getFolder('JobApplication');
// if temp folder is not existing, create one
if (!$storage->hasFolderInFolder('temp', $folder)) {
$tempFolder = $storage->createFolder('temp', $folder);
}
$filePath = Environment::getPublicPath() . '/fileadmin/' . self::TYPO3_TMP_FOLDER . $fileName;
$tempFilePath = $firstFile['tmp_name'];
$success = GeneralUtility::upload_copy_move($tempFilePath, $filePath);
......
......@@ -551,7 +551,7 @@ class JoblistController extends ActionController {
$this->redirect('applyForm');
} catch (\Exception $exception) {
if ($exception instanceof StopActionException){
if ($exception instanceof StopActionException) {
return NULL;
}
$this->deleteTmpFolder($folderName);
......@@ -706,12 +706,14 @@ class JoblistController extends ActionController {
$resourceFactory = $this->objectManager->get(ResourceFactory::class);
$storage = $resourceFactory->getStorageObject(1);
$folder = $storage->getFolder('/JobApplication/');
$tempFolder = $storage->getFolder('/JobApplication/temp');
if (!$storage->hasFolderInFolder($folderName, $folder)) {
$newFolder = $storage->createFolder($folderName, $folder);
} else {
$newFolder = $storage->getFolder('/JobApplication/' . $folderName);
}
$tempFolder = $storage->getFolder('/JobApplication/temp/');
// Move uploaded files & csv fo real folder and delete the tmp folder
foreach (self::UPLOADED_FILES as $singleFilePostKey) {
......@@ -723,12 +725,11 @@ class JoblistController extends ActionController {
throw new TypeConverterException('File extension is not allowed!', 1399312430);
}
if(!$newFolder->hasFile($filePathInfo['basename'])) {
if (!$newFolder->hasFile($filePathInfo['basename'])) {
$singleFileToMove = $storage->getFileInFolder($filePathInfo['basename'], $tempFolder);
// when we reload etc this image might already be moved.
$usableFile = $storage->moveFile($singleFileToMove, $newFolder);
}
else {
} else {
$usableFile = $newFolder->getFile($filePathInfo['basename']);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment