php - Upload file doesn't save to specify folder, throw error -


the error warning: move_uploaded_file(uploads/cv/23456543555555curriculum vitae.doc): failed open stream: no such file or directory in c:\wamp\www\job-application\include\application.class.php on line 121

warning: move_uploaded_file(): unable move 'c:\wamp\tmp\php7ea1.tmp' 'uploads/cv/23456543555555curriculum vitae.doc' in c:\wamp\www\job-application\include\application.class.php on line 121

the code follows below;

$allowedextsdoc = array("docx", "pdf", "doc");             $temp = explode(".", $_files["file"]["name"]);             $extensiondoc = end($temp);             $uploaddircv = 'uploads/cv/';             $uploadfilecv = $uploaddircv . basename($phone.$_files['file']['name']);             if (in_array($extensiondoc, $allowedextsdoc))                 {                     if ($_files["file"]["error"] > 0)                     {                         $this->error .= $_files["file"]["error"] . "<br>";                     }                     else                     {                            if (file_exists($uploaddircv . $_files["file"]["name"]))                         {                             $this->error .= $_files["file"]["name"] . " exists. <br/>";                         }                         else                         {                             move_uploaded_file($_files["file"]["tmp_name"],$uploadfilecv);                             $fileloc = $this->sitepath.$uploadfilecv;                         }                     }                 }             else             {                 $this->error .= "invalid file <br/>";             } 

make sure directories: c:\wamp\tmp\ , uploads/cv/ exists , writable apache.

after that, try use complete path uploads folder.

$uploaddircv = realpath(dirname(__file__) . '/../uploads/cv/') . '/'; 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -