Skip to content
This repository was archived by the owner on Mar 30, 2021. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions spoon/form/file.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,13 @@ public function isAllowedMimeType(array $allowedTypes, $error = null)
if($this->isFilled())
{
// get image properties
$properties = @getimagesize($_FILES[$this->attributes['name']]['tmp_name']);
$mime = @mime_content_type($_FILES[$this->attributes['name']]['tmp_name']);

// invalid properties
if($properties === false) $return = false;
if($mime === false) $return = false;

// search for mime-type
else $return = in_array($properties['mime'], $allowedTypes);
else $return = in_array($mime, $allowedTypes);

// add error if needed
if(!$return && $error !== null) $this->setError($error);
Expand Down Expand Up @@ -385,7 +385,7 @@ public function moveFile($path, $chmod = 0755)
* @return string
* @param SpoonTemplate[optional] $template The template to parse the element in.
*/
public function parse(SpoonTemplate $template = null)
public function parse($template = null)
{
// name is required
if($this->attributes['name'] == '') throw new SpoonFormException('A name is required for a file field. Please provide a name.');
Expand Down