Use date-title input directory names
This commit is contained in:
parent
52160b51fc
commit
e299afc4ef
1 changed files with 1 additions and 1 deletions
2
new.php
2
new.php
|
|
@ -96,7 +96,7 @@ try {
|
||||||
if ($action === 'create') {
|
if ($action === 'create') {
|
||||||
$title = trim($_POST['title'] ?? '');
|
$title = trim($_POST['title'] ?? '');
|
||||||
if ($title === '') throw new RuntimeException('Title is required.');
|
if ($title === '') throw new RuntimeException('Title is required.');
|
||||||
$slug = date('Ymd_His') . '_' . slugify($title);
|
$slug = date('Ymd') . '_' . slugify($title);
|
||||||
$dir = $config['uploads_dir'] . '/' . $slug;
|
$dir = $config['uploads_dir'] . '/' . $slug;
|
||||||
if (!mkdir($dir, 0775, true)) throw new RuntimeException('Cannot create input directory.');
|
if (!mkdir($dir, 0775, true)) throw new RuntimeException('Cannot create input directory.');
|
||||||
$media = save_uploads('media', $dir, $allowedMedia);
|
$media = save_uploads('media', $dir, $allowedMedia);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue