summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2012-01-25 12:47:58 +0100
committerFlorian Pritz <bluewind@xinu.at>2012-01-25 12:47:58 +0100
commitb433bcc5da665c171b2ac293892d3d19eef80e2f (patch)
tree0e8dc774c94c89b3dbec0d2024ce5f965d52f6e1 /application
parentcbd6a01c195c3f4ca69a1c25d4b781b537983faf (diff)
allow client to overwrite filename
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application')
-rw-r--r--application/controllers/file.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/application/controllers/file.php b/application/controllers/file.php
index 0c2db3e0c..4bb336ad0 100644
--- a/application/controllers/file.php
+++ b/application/controllers/file.php
@@ -233,7 +233,18 @@ class File extends CI_Controller {
$id = $this->file_mod->new_id();
$hash = md5_file($_FILES['file']['tmp_name']);
- $filename = $_FILES['file']['name'];
+
+ // work around a curl bug and allow the client to send the real filename base64 encoded
+ $filename = $this->input->post("filename");
+ if ($filename !== false) {
+ $filename = base64_decode($filename, true);
+ }
+
+ // fall back if base64_decode failed
+ if ($filename === false) {
+ $filename = $_FILES['file']['name'];
+ }
+
$folder = $this->file_mod->folder($hash);
file_exists($folder) || mkdir ($folder);
$file = $this->file_mod->file($hash);