Commit dfd4016e authored by Carsten  Rose's avatar Carsten Rose
Browse files

Upload: replace 'rename' with 'copy/unlink'

parent 6bd020d6
Pipeline #938 passed with stage
in 1 minute and 41 seconds
......@@ -213,6 +213,7 @@ const ERROR_STORE_KEY_EXIST = 1201;
// I/O Error
const ERROR_IO_READ_FILE = 1300;
const ERROR_IO_COPY = 1301;
const ERROR_IO_WRITE = 1303;
const ERROR_IO_OPEN = 1304;
const ERROR_IO_UNLINK = 1305;
......
......@@ -1286,8 +1286,13 @@ class Support {
Support::mkDirParent($pathFileName);
if (!rename($srcFile, $pathFileName)) {
throw new UserFormException("Rename file: '$srcFile' > '$pathFileName'", ERROR_IO_RENAME);
// Do not use 'rename' - might cause trouble if src and dest are on different filesystems.
if (!copy($srcFile, $pathFileName)) {
throw new UserFormException("Copy file: '$srcFile' > '$pathFileName'", ERROR_IO_COPY);
}
if (!unlink($srcFile)) {
throw new UserFormException("Delete temporary uploaded file: '$srcFile'", ERROR_IO_UNLINK);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment