aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_upload.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/functions_upload.php')
-rw-r--r--phpBB/includes/functions_upload.php31
1 files changed, 26 insertions, 5 deletions
diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php
index 4181896eca..04d483e14c 100644
--- a/phpBB/includes/functions_upload.php
+++ b/phpBB/includes/functions_upload.php
@@ -44,10 +44,16 @@ class filespec
var $upload = '';
/**
+ * The plupload object
+ * @var \phpbb\plupload\plupload
+ */
+ protected $plupload;
+
+ /**
* File Class
* @access private
*/
- function filespec($upload_ary, $upload_namespace)
+ function filespec($upload_ary, $upload_namespace, \phpbb\plupload\plupload $plupload = null)
{
if (!isset($upload_ary))
{
@@ -80,6 +86,7 @@ class filespec
$this->local = (isset($upload_ary['local_mode'])) ? true : false;
$this->upload = $upload_namespace;
+ $this->plupload = $plupload;
}
/**
@@ -161,12 +168,14 @@ class filespec
*/
function is_uploaded()
{
- if (!$this->local && !is_uploaded_file($this->filename))
+ $is_plupload = $this->plupload && $this->plupload->is_active();
+
+ if (!$this->local && !$is_plupload && !is_uploaded_file($this->filename))
{
return false;
}
- if ($this->local && !file_exists($this->filename))
+ if (($this->local || $is_plupload) && !file_exists($this->filename))
{
return false;
}
@@ -564,16 +573,28 @@ class fileupload
* Upload file from users harddisk
*
* @param string $form_name Form name assigned to the file input field (if it is an array, the key has to be specified)
+ * @param \phpbb\plupload\plupload $plupload The plupload object
+ *
* @return object $file Object "filespec" is returned, all further operations can be done with this object
* @access public
*/
- function form_upload($form_name)
+ function form_upload($form_name, \phpbb\plupload\plupload $plupload = null)
{
global $user, $request;
$upload = $request->file($form_name);
unset($upload['local_mode']);
- $file = new filespec($upload, $this);
+
+ if ($plupload)
+ {
+ $result = $plupload->handle_upload($form_name);
+ if (is_array($result))
+ {
+ $upload = array_merge($upload, $result);
+ }
+ }
+
+ $file = new filespec($upload, $this, $plupload);
if ($file->init_error)
{