bug 1639 fixed: the upload form now correctly uses the $conf['upload_dir']

parameter (web API already use it).

By default, the $conf['upload_dir'] is no longer dependent to PHPWG_ROOT_PATH
because it becomes a real mess when admin/include/uploadify.php (called
directly, not from an include) tries to perform an upload.

Improvement: make clearer how $conf['upload_dir'] can be set (relative to the
Piwigo installation directory + HTTP reachable)

git-svn-id: http://piwigo.org/svn/trunk@6052 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
plegall 2010-05-03 12:49:26 +00:00
parent 89384aa6b1
commit 0c8cebe044
3 changed files with 7 additions and 5 deletions

View file

@ -31,7 +31,7 @@ function add_uploaded_file($source_filepath, $original_filename=null, $categorie
// upload directory hierarchy // upload directory hierarchy
$upload_dir = sprintf( $upload_dir = sprintf(
PHPWG_ROOT_PATH.'upload/%s/%s/%s', PHPWG_ROOT_PATH.$conf['upload_dir'].'/%s/%s/%s',
$year, $year,
$month, $month,
$day $day
@ -96,7 +96,7 @@ function add_uploaded_file($source_filepath, $original_filename=null, $categorie
'file' => isset($original_filename) ? $original_filename : basename($file_path), 'file' => isset($original_filename) ? $original_filename : basename($file_path),
'date_available' => $dbnow, 'date_available' => $dbnow,
'tn_ext' => 'jpg', 'tn_ext' => 'jpg',
'path' => preg_replace('/^.*?upload/', './upload', $file_path), 'path' => preg_replace('#^'.preg_quote(PHPWG_ROOT_PATH).'#', '', $file_path),
'filesize' => $file_infos['filesize'], 'filesize' => $file_infos['filesize'],
'width' => $file_infos['width'], 'width' => $file_infos['width'],
'height' => $file_infos['height'], 'height' => $file_infos['height'],

View file

@ -119,7 +119,7 @@ if (isset($_POST['submit_upload']))
$extension = pathinfo($_FILES['image_upload']['name'][$idx], PATHINFO_EXTENSION); $extension = pathinfo($_FILES['image_upload']['name'][$idx], PATHINFO_EXTENSION);
if ('zip' == strtolower($extension)) if ('zip' == strtolower($extension))
{ {
$upload_dir = PHPWG_ROOT_PATH.'upload/buffer'; $upload_dir = $conf['upload_dir'].'/buffer';
prepare_directory($upload_dir); prepare_directory($upload_dir);
$temporary_archive_name = date('YmdHis').'-'.generate_key(10); $temporary_archive_name = date('YmdHis').'-'.generate_key(10);

View file

@ -761,8 +761,10 @@ $conf['light_slideshow'] = true;
// or other plugin variables etc // or other plugin variables etc
$conf['local_data_dir'] = dirname(dirname(__FILE__)).'/_data'; $conf['local_data_dir'] = dirname(dirname(__FILE__)).'/_data';
// where should the API add photos? // where should the API/UploadForm add photos? This path must be relative to
$conf['upload_dir'] = PHPWG_ROOT_PATH.'upload'; // 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? // 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'; $conf['no_photo_yet_url'] = 'admin.php?page=photos_add';