testing directory existance before creating it
This commit is contained in:
parent
6d4a3ba11f
commit
3208fc16f8
|
@ -45,7 +45,10 @@ switch ($type) {
|
|||
|
||||
$temp_dir = "../.temp";
|
||||
$chunk_path = $temp_dir . "/" . $file_id . "-";
|
||||
mkdir($temp_dir);
|
||||
|
||||
if (!file_exists($temp_dir)) {
|
||||
mkdir($temp_dir);
|
||||
}
|
||||
|
||||
if ($type === "video-gif-upload") {
|
||||
// Uploaded file size must not exceed 2gb
|
||||
|
|
|
@ -133,7 +133,10 @@ class FileUploader
|
|||
{
|
||||
$target_name = $GLOBALS["upload_directory"] . $this->file_id . "." . $this->file_extension;
|
||||
try {
|
||||
mkdir($GLOBALS["upload_directory"]);
|
||||
if (!file_exists($GLOBALS["upload_directory"])) {
|
||||
mkdir($GLOBALS["upload_directory"]);
|
||||
}
|
||||
|
||||
if (!move_uploaded_file($this->file["tmp_name"], $target_name)) {
|
||||
error("Uploading image did not succeed. Check whether the destination is writeable.");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue