Changeset 2504
- Timestamp:
- 05/30/08 17:54:19 (7 months ago)
- Location:
- branches/0.11
- Files:
-
- 2 modified
-
CHANGELOG (modified) (1 diff)
-
src/request/AgaviUploadedFile.class.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/0.11/CHANGELOG
r2500 r2504 5 5 -------------------------- 6 6 7 ADD: Add convenience methods to AgaviUploadedFile (#607) (David) 7 8 ADD: Change error class handling in FPF to set classes on elements returned by the respective XPath expressions, not the original elements (#768) (David) 8 9 ADD: Allow arrays as values for web request sources. (#675) (David) -
branches/0.11/src/request/AgaviUploadedFile.class.php
r2258 r2504 128 128 129 129 /** 130 * Retrieve the contents of the uploaded file. 131 * 132 * @return string The file contents. 133 * 134 * @throws AgaviException If the file has errors or has been moved. 135 * 136 * @author David Zülke <dz@bitxtender.com> 137 * @since 0.11.2 138 */ 139 public function getContents() 140 { 141 if($this->hasError() || !$this->isMovable()) { 142 throw new AgaviException('Cannot get contents of erroneous or moved file.'); 143 } 144 145 return file_get_contents($this->tmp_name); 146 } 147 148 /** 149 * Retrieve a stream handle of the uploaded file. 150 * 151 * @param string The fopen mode, defaults to 'rb'. 152 * 153 * @return resource The stream. 154 * 155 * @throws AgaviException If the file has errors or has been moved. 156 * 157 * @author David Zülke <dz@bitxtender.com> 158 * @since 0.11.2 159 */ 160 public function getStream($mode = 'rb') 161 { 162 if($this->hasError() || !$this->isMovable()) { 163 throw new AgaviException('Cannot get contents of erroneous or moved file.'); 164 } 165 166 return fopen($this->tmp_name, $mode); 167 } 168 169 /** 130 170 * Move the uploaded file. 131 171 * … … 135 175 * @param int The mode to use when creating subdirs, defaults to 0775. 136 176 * 137 * @return bool True, if the operation was successful, false otherwise.177 * @return bool True, if the operation was successful, false otherwise. 138 178 * 139 179 * @throws AgaviFileException If chmod or mkdir calls failed.

