Changeset 26562


Ignore:
Timestamp:
Jan 9, 2014, 9:04:26 PM (7 years ago)
Author:
plg
Message:

new experimental feature: upload any type of file.

If $confupload_form_all_types=true, then we take $conffile_ext

Else we only accept $confpicture_ext

must be completed with specific code in add_uploaded_file function (admin/include/functions_upload.inc.php)

Location:
extensions/community
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • extensions/community/add_photos.php

    r23085 r26562  
    381381include_once(PHPWG_ROOT_PATH.'admin/include/photos_add_direct_prepare.inc.php');
    382382
     383if (isset($conf['upload_form_all_types']) and $conf['upload_form_all_types'])
     384{
     385  $upload_file_types = $conf['file_ext'];
     386}
     387else
     388{
     389  $upload_file_types = $conf['picture_ext'];
     390}
     391
     392$unique_exts = array_unique(array_map('strtolower', $upload_file_types));
     393
     394$is_windows = true;
     395if (stripos($_SERVER['HTTP_USER_AGENT'], 'Win') === false)
     396{
     397  $is_windows = false;
     398}
     399
     400$uploadify_exts = array();
     401foreach ($unique_exts as $ext)
     402{
     403  $uploadify_exts[] = $ext;
     404
     405  // Windows is not case sensitive and there is a bug with Firefox on
     406  // Windows: the list of extensions is truncated and last extensions are
     407  // not taken into account, so we have to make it as short as possible.
     408  if (!$is_windows)
     409  {
     410    $uploadify_exts[] = strtoupper($ext);
     411  }
     412}
     413
     414$template->assign(
     415  array(
     416    'upload_file_types' => implode(', ', $unique_exts),
     417    'uploadify_fileTypeExts' => implode(';', prepend_append_array_items($uploadify_exts, '*.', '')),
     418    )
     419  );
     420
    383421$quota_available = array(
    384422  'summary' => array(),
  • extensions/community/add_photos.tpl

    r23393 r26562  
    269269    'multi'          : true,
    270270    'fileTypeDesc'   : 'Photo files',
    271     'fileTypeExts'   : '*.jpg;*.JPG;*.jpeg;*.JPEG;*.png;*.PNG;*.gif;*.GIF',
     271    'fileTypeExts'   : '{/literal}{$uploadify_fileTypeExts}{literal}',
    272272    'fileSizeLimit'  : sizeLimit,
    273273    'progressData'   : 'percentage',
Note: See TracChangeset for help on using the changeset viewer.