diff options
author | Alex AUVOLAT <alexis211@gmail.com> | 2012-06-21 17:12:06 +0200 |
---|---|---|
committer | Alex AUVOLAT <alexis211@gmail.com> | 2012-06-21 17:12:06 +0200 |
commit | 80e0f88b56ca7e306d415604c608d8bc09496e21 (patch) | |
tree | 913d120f4e245a7b95bc948d12fa913eed01d840 /lib/file/upload.php | |
parent | 889e8eaf7c40817663dd602a21ac771062ccac3b (diff) | |
download | Bits-80e0f88b56ca7e306d415604c608d8bc09496e21.tar.gz Bits-80e0f88b56ca7e306d415604c608d8bc09496e21.zip |
Changes. But minor. Mostly usability changes.
Diffstat (limited to 'lib/file/upload.php')
-rw-r--r-- | lib/file/upload.php | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/file/upload.php b/lib/file/upload.php index 4b5299d..21fa065 100644 --- a/lib/file/upload.php +++ b/lib/file/upload.php @@ -7,6 +7,7 @@ require("lib/conf/file.php"); if (isset($_FILES['file']) && isset($_POST['name'])) { $name = esca($_POST['name']); + $folder = (isset($_POST['folder']) ? intval($_POST['folder']) : 0); if ($name == "") $name = $_FILES['file']['name']; if ($_FILES['file']['error'] != 0) { $error = "Sorry, an error occurred while uploading your file. Try with a smaller one."; @@ -15,7 +16,7 @@ if (isset($_FILES['file']) && isset($_POST['name'])) { $origname = strtolower(basename($_FILES['file']['name'])); $type = preg_replace("#^.+\.([a-z0-9]+)$#", "$1", $origname); - sql("INSERT INTO files(owner, extension, name, upl_date) VALUES(" . $user['id'] . ", '$type', '" . escs($name) . "', NOW())"); + sql("INSERT INTO files(owner, folder, extension, name, upl_date) VALUES(" . $user['id'] . ", $folder, '$type', '" . escs($name) . "', NOW())"); $id = mysql_insert_id(); $filen = $savedir . $id . "." . $type; if (!copy($_FILES['file']['tmp_name'], $filen)) { |