Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function save(){
- //var_dump($_FILES['file_upload']);
- if($this->id){
- $this->update();
- } else{
- if(!empty($this->errors)){
- return false;
- }
- if(empty($this->filename)|| empty($this->tmp_path)){
- $this->errors[]="The file was not available";
- return false;
- }
- $target_path=SITE_ROOT.DS.'admin'.DS.$this->upload_directory.DS.$this->filename;
- //echo $target_path;
- /* The problem is here but I can't find it - If I comment this out
- I can upload the same file multiple times*/
- if(file_exists($target_path)){
- $this->errors[]="The file {$this->filename} already exists";
- return false;
- }
- if(move_uploaded_file($this->tmp_path,$target_path)){
- if($this->create()){
- unset($this->tmp_path);
- return true;
- }
- } else{
- $this->errors[]="Check File Permissions!!";
- return false;
- } // end inner else
- } // end else
- } // end save
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement