To participate you must create an account on apostrophenow.org. If you have already done so, click Login.
Changeset 4487
- Timestamp:
- 01/20/12 14:25:41 (4 months ago)
- Author:
- tboutell
- Message:
-
The getFileName() method, to be useful, should return a full path to where the file was actually stored after making the name safe and so forth. This is a change, I'll talk to Wes
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r4485
|
r4487
|
|
| 69 | 69 | private $sizeLimit = 10485760; |
| 70 | 70 | private $file; |
| | 71 | private $acceptedFilename; |
| 71 | 72 | |
| 72 | 73 | function __construct(array $allowedExtensions = array(), $sizeLimit = 10485760){ |
| … |
… |
|
| 150 | 151 | } |
| 151 | 152 | |
| 152 | | if ($this->file->save($uploadDirectory . $filename . '.' . $ext)){ |
| | 153 | $acceptedFilename = $uploadDirectory . $filename . '.' . $ext; |
| | 154 | if ($this->file->save($acceptedFilename)) { |
| | 155 | error_log("accepted"); |
| | 156 | $this->acceptedFilename = $acceptedFilename; |
| 153 | 157 | return array('success' => true); |
| 154 | 158 | } else { |
| … |
… |
|
| 156 | 160 | 'The upload was cancelled, or server error encountered'); |
| 157 | 161 | } |
| 158 | | |
| 159 | 162 | } |
| 160 | 163 | |
| 161 | 164 | /** |
| 162 | | * Returns name of handled file. |
| | 165 | * Returns full path to handled file. |
| 163 | 166 | * |
| 164 | | * False if no file exists. |
| | 167 | * False if no file has been successfully handled. |
| 165 | 168 | * |
| 166 | 169 | * |
| … |
… |
|
| 169 | 172 | public function getFileName() |
| 170 | 173 | { |
| 171 | | if (!$this->file) |
| | 174 | error_log("Getting filename"); |
| | 175 | if (!isset($this->acceptedFilename)) |
| 172 | 176 | { |
| 173 | 177 | return false; |
| 174 | 178 | } |
| | 179 | error_log("Returning {$this->acceptedFilename}"); |
| 175 | 180 | |
| 176 | | return $this->file->getName(); |
| | 181 | return $this->acceptedFilename; |
| 177 | 182 | } |
| 178 | 183 | } |
Download in other formats: