showCMSPathway(); $container = ($fileorcontainer instanceof remositoryFile ) ? $fileorcontainer->getContainer() : $fileorcontainer; if ($container instanceof remositoryContainer ) $this->pathwayHTML($container); } echo <<{$this->show(_DOWN_ACCESS_REFUSED)}

{$this->show(_DOWN_MAYBE_LOGIN)}

NO_ACCESS; $this->filesFooterHTML (); $this->remositoryCredits(false); } function uploadLimit () { echo <<alert('{$this->show(_ERR9)}') {$this->pathwayHTML(null)}
 
{$this->show(_DOWN_ALL_DONE)} UPLOAD_LIMIT; } public function noFileDiagnostics ($user) { $heading = _DOWN_NO_FILE_RECEIVED; $errornum = isset($_FILES['userfile']['error']) ? $_FILES['userfile']['error'] : -1; $error = $this->file_upload_error_message($errornum); $filename = empty($_FILES['userfile']['name']) ? 'No file name provided' : $_FILES['userfile']['name']; $filesize = empty($_FILES['userfile']['size']) ? 'No file size provided' : $_FILES['userfile']['size']; $tempfile = empty($_FILES['userfile']['tmp_name']) ? 'No file path provided' : $_FILES['userfile']['tmp_name']; $isuploadednum = empty($_FILES['userfile']['tmp_name']) ? 0 : is_uploaded_file($tempfile); $isuploaded = $this->yesno($isuploadednum); $phpuploads = $this->yesno($this->showPHP('file_uploads')); if ($user->isAdmin()) echo << $heading   Error message: $error Real file name: $filename File size (bytes): $filesize Temporary file path: $tempfile Is it an uploaded file?: $isuploaded   PHP file_uploads: $phpuploads PHP upload_tmp_dir: {$this->showPHP('upload_tmp_dir')} PHP upload_max_filesize: {$this->showPHP('upload_max_filesize')} PHP post_max_size: {$this->showPHP('post_max_size')}  

Points to watch out for are:

  • There should be no error message (typically, zero will be displayed)
  • The real file name should correspond with the name of the file you sent
  • The file size should be the correct size for the file you sent
  • Temporary file path should look like a genuine specification for a file on the host system. Its precise character will vary across different systems. It should be a valid path including the name of the temporary file. If it is not overriden by the PHP config (see below) the temporary path will be the system temporary directory with file name added. The file name is generated by the system.
  • If PHP is permitting file uploads, the file_uploads setting will be non zero.
  • There may be no temporary upload directory specified in the PHP config. In this case, the system temporary directory will be used. For a Unix style system, this defaults to /tmp but can be configured to be anything. If the file path is specified, you would expect it to form part of the temporary file path shown above, followed by the temporary name. A temporary upload directory specified to PHP will override the system temporary directory.
  • PHP will have a setting for the maximum permitted uploaded file size.
  • PHP also has a setting for the maximmum POST size, and the file upload is a POST so the setting must be at least a little larger than the maximum permitted upload size, or it will be a constraint on uploads.

Note that the PHP settings cannot be overriden by a program like Remository. If they are too restrictive, you need to talk to your hosting provider, or consider altering your PHP configuration if it is under your own control.

DIAGNOSE_UPLOAD; else $this->uploadError($heading); } private function file_upload_error_message($error_code) { switch ($error_code) { case UPLOAD_ERR_INI_SIZE: return 'The uploaded file exceeds the upload_max_filesize directive in php.ini'; case UPLOAD_ERR_FORM_SIZE: return 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'; case UPLOAD_ERR_PARTIAL: return 'The uploaded file was only partially uploaded'; case UPLOAD_ERR_NO_FILE: return 'No file was uploaded'; case UPLOAD_ERR_NO_TMP_DIR: return 'Missing a temporary folder'; case UPLOAD_ERR_CANT_WRITE: return 'Failed to write file to disk'; case UPLOAD_ERR_EXTENSION: return 'File upload stopped by extension'; default: return 'Unknown upload error'; } } private function yesno ($bool) { return $bool ? _YES : _NO; } private function showPHP ($inivalue) { return ini_get($inivalue); } public function uploadError ($message) { echo << $message SIMPLE_ERROR; } }