aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--admin/include/functions_upload.inc.php4
-rw-r--r--admin/photos_add_direct.php2
-rw-r--r--include/config_default.inc.php6
3 files changed, 7 insertions, 5 deletions
diff --git a/admin/include/functions_upload.inc.php b/admin/include/functions_upload.inc.php
index fa8944d70..2d8be3ceb 100644
--- a/admin/include/functions_upload.inc.php
+++ b/admin/include/functions_upload.inc.php
@@ -31,7 +31,7 @@ function add_uploaded_file($source_filepath, $original_filename=null, $categorie
// upload directory hierarchy
$upload_dir = sprintf(
- PHPWG_ROOT_PATH.'upload/%s/%s/%s',
+ PHPWG_ROOT_PATH.$conf['upload_dir'].'/%s/%s/%s',
$year,
$month,
$day
@@ -96,7 +96,7 @@ function add_uploaded_file($source_filepath, $original_filename=null, $categorie
'file' => isset($original_filename) ? $original_filename : basename($file_path),
'date_available' => $dbnow,
'tn_ext' => 'jpg',
- 'path' => preg_replace('/^.*?upload/', './upload', $file_path),
+ 'path' => preg_replace('#^'.preg_quote(PHPWG_ROOT_PATH).'#', '', $file_path),
'filesize' => $file_infos['filesize'],
'width' => $file_infos['width'],
'height' => $file_infos['height'],
diff --git a/admin/photos_add_direct.php b/admin/photos_add_direct.php
index 6f3991732..710eaf739 100644
--- a/admin/photos_add_direct.php
+++ b/admin/photos_add_direct.php
@@ -119,7 +119,7 @@ if (isset($_POST['submit_upload']))
$extension = pathinfo($_FILES['image_upload']['name'][$idx], PATHINFO_EXTENSION);
if ('zip' == strtolower($extension))
{
- $upload_dir = PHPWG_ROOT_PATH.'upload/buffer';
+ $upload_dir = $conf['upload_dir'].'/buffer';
prepare_directory($upload_dir);
$temporary_archive_name = date('YmdHis').'-'.generate_key(10);
diff --git a/include/config_default.inc.php b/include/config_default.inc.php
index 78d5fea54..b833f0bb5 100644
--- a/include/config_default.inc.php
+++ b/include/config_default.inc.php
@@ -761,8 +761,10 @@ $conf['light_slideshow'] = true;
// or other plugin variables etc
$conf['local_data_dir'] = dirname(dirname(__FILE__)).'/_data';
-// where should the API add photos?
-$conf['upload_dir'] = PHPWG_ROOT_PATH.'upload';
+// where should the API/UploadForm add photos? This path must be relative to
+// the Piwigo installation directory (but can be outside, as long as it's
+// reachable from your webserver).
+$conf['upload_dir'] = './upload';
// where should the user be guided when there is no photo in his gallery yet?
$conf['no_photo_yet_url'] = 'admin.php?page=photos_add';