diff options
author | xue <> | 2006-09-05 11:29:01 +0000 |
---|---|---|
committer | xue <> | 2006-09-05 11:29:01 +0000 |
commit | 8f1fa1c2bb6c2b7cbb493bd2038669b1e1a8ca7d (patch) | |
tree | 01cb88f4d17f0c9f53a837cfaec2b5d2a52d912a /framework/Web | |
parent | f587496dcba7c7030062b5dfdc7612f3ed89dbf9 (diff) |
Fixed #358.
Diffstat (limited to 'framework/Web')
-rw-r--r-- | framework/Web/UI/WebControls/TFileUpload.php | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/framework/Web/UI/WebControls/TFileUpload.php b/framework/Web/UI/WebControls/TFileUpload.php index 62c51ccf..17bdcf5b 100644 --- a/framework/Web/UI/WebControls/TFileUpload.php +++ b/framework/Web/UI/WebControls/TFileUpload.php @@ -174,22 +174,21 @@ class TFileUpload extends TWebControl implements IPostBackDataHandler, IValidata * @param string the file name used to save the uploaded file
* @param boolean whether to delete the temporary file after saving.
* If true, you will not be able to save the uploaded file again.
- * @throws TInvalidOperationException file uploading failed or the uploaded
- * file cannot be found on the server.
+ * @return boolean true if the file saving is successful
*/
public function saveAs($fileName,$deleteTempFile=true)
{
if($this->_errorCode===UPLOAD_ERR_OK)
{
if($deleteTempFile)
- move_uploaded_file($this->_localName,$fileName);
+ return move_uploaded_file($this->_localName,$fileName);
else if(is_uploaded_file($this->_localName))
- file_put_contents($fileName,file_get_contents($this->_localName));
+ return file_put_contents($fileName,file_get_contents($this->_localName))!==false
else
- throw new TInvalidOperationException('fileupload_saveas_failed');
+ return false;
}
else
- throw new TInvalidOperationException('fileupload_saveas_forbidden');
+ return false;
}
/**
|