using whole filename for photo_id
This commit is contained in:
parent
97555013a1
commit
51278caac3
@ -60,11 +60,11 @@ if (!(file_exists($dir) && is_dir($dir)))
|
||||
$safe_name = mysqli_real_escape_string($database, $_POST["name"]);
|
||||
$safe_desc = isset($_POST["desc"]) ? mysqli_real_escape_string($database, $_POST["desc"]) : null;
|
||||
|
||||
$photo_id = count(glob($dir . "/*"));
|
||||
$photo_id = count(glob($dir . "/*")) . "." . $file_format;
|
||||
|
||||
$database -> query("INSERT INTO post (title, description, author, photo_id) VALUES (\"" . $safe_name . "\", " . ($safe_desc == null ? "NULL" : "\"" . $safe_desc . "\"") . ", " . $user_id . ", " . $photo_id . ")");
|
||||
$database -> query("INSERT INTO post (title, description, author, photo_id) VALUES (\"" . $safe_name . "\", " . ($safe_desc == null ? "NULL" : "\"" . $safe_desc . "\"") . ", " . $user_id . ", \"" . $photo_id . "\")");
|
||||
|
||||
move_uploaded_file($_FILES["file_upload"]["tmp_name"], $dir . "/" . $photo_id . "." . $file_format);
|
||||
move_uploaded_file($_FILES["file_upload"]["tmp_name"], $dir . "/" . $photo_id);
|
||||
|
||||
send:
|
||||
header('Content-type: application/json');
|
||||
|
Loading…
x
Reference in New Issue
Block a user