$folder_path = "./uploads/"; $file_name = $_FILES["file"]["name"]; $file_path = $folder_path . $file_name; if (ilUtil::moveUploadedFile($_FILES["file"]["tmp_name"], $file_path)) { echo "File uploaded successfully"; } else { echo "Oops, something went wrong!"; }
$file_ext = strtolower(pathinfo($_FILES["file"]["name"], PATHINFO_EXTENSION)); $file_name = uniqid() . '.' . $file_ext; $file_path = "./uploads/" . $file_name; if (ilUtil::moveUploadedFile($_FILES["file"]["tmp_name"], $file_path)) { echo "File uploaded successfully as: " . $file_name; } else { echo "Oops, something went wrong!"; }In this example, the uploaded file is assigned a unique name using PHP's `uniqid()` function and then moved to the `uploads` folder. Package Library: ILIAS Core PHP Framework