Skip to content

Commit

Permalink
some locale stuff
Browse files Browse the repository at this point in the history
If unicode uploads fail, try to set a locale in the config file
  • Loading branch information
splitbrain committed Nov 28, 2011
1 parent bdb04fb commit de17233
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
3 changes: 3 additions & 0 deletions conf/settings.conf.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@
# Store passwords hashed (1) or in plain text (0)
# you need to delete your users.conf.php whenever you change this
$conf['passhash'] = 1;

# you might want to set a locale if Unicode filenames fail
#setlocale(LC_ALL,'en_US.utf-8');
1 change: 0 additions & 1 deletion inc/GUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ function createUploader(){
var uploader = new qq.FileUploader({
element: document.getElementById('file-uploader'),
action: 'up<?php $this->wasp('?')?>',
debug: true
});
}

Expand Down
9 changes: 7 additions & 2 deletions inc/fileuploader.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,13 @@ function handleUpload($uploadDirectory, $replaceOldFile = FALSE){

$pathinfo = pathinfo($this->file->getName());
$filename = $pathinfo['filename'];
//$filename = md5(uniqid());
$ext = $pathinfo['extension'];
$ext = $pathinfo['extension'];
$filename = preg_replace('/^\.+/','',$filename);

if($filename == ''){
return array('error' => 'No valid file name given (or locale not setup)');
}


if($this->allowedExtensions && !in_array(strtolower($ext), $this->allowedExtensions)){
$these = implode(', ', $this->allowedExtensions);
Expand Down
1 change: 1 addition & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@

// GUI actions
require 'inc/GUI.php';
header('Content-Type: text/html; charset=utf-8');
$GUI = new GUI($CONF,$REALUSER,$USER,$AUTH);
$GUI->header();
switch ($DO){
Expand Down

0 comments on commit de17233

Please sign in to comment.