Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
sg_jobs
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TYPO3
sg_jobs
Commits
9643dd05
Commit
9643dd05
authored
2 years ago
by
Matthias Adrowski
Browse files
Options
Downloads
Patches
Plain Diff
[TASK] Create temp folder in JobApplication if not existing
parent
a4770c8d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Classes/Controller/Ajax/UploadController.php
+5
-1
5 additions, 1 deletion
Classes/Controller/Ajax/UploadController.php
Classes/Controller/JoblistController.php
+6
-5
6 additions, 5 deletions
Classes/Controller/JoblistController.php
with
11 additions
and
6 deletions
Classes/Controller/Ajax/UploadController.php
+
5
−
1
View file @
9643dd05
...
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
Classes/Controller/JoblistController.php
+
6
−
5
View file @
9643dd05
...
...
@@ -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'
]);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment