Location: PHPKode > projects > DIY Blog > diy-blog/classes/diy-blog/backend/controller/forms/FileForm.class.php
<?php

/**
 * Abstracts file upload request parameters.
 * @package diy-blog.backend.controller.forms
 * @author	Martynas Jusevicius <hide@address.com>
 * @link	http://www.xml.lt
 */

class FileForm extends Form
{
	private $fileName = null;
	private $contentType = null;
	
	public function __construct(Request $request)
	{
		$multiReq = new MultipartRequest($request, "");
		$this->filesystemName = $multiReq->getFilesystemName("file");
		$this->originalName = $multiReq->getOriginalFileName("file");
		$this->contentType = $multiReq->getContentType("file");
		//print_r($this);
	}
	
	public function getFilesystemName()
	{
		return $this->filesystemName;
	}

	public function getOriginalName()
	{
		return $this->originalName;
	}

	public function getContentType()
	{
		return $this->contentType;
	}

	public function validate()
	{
		$errors = array();

		if ($this->originalName == null) $errors[] = new Error("noFile");

		return $errors;
	}
}

?>
Return current item: DIY Blog