Reputation: 183
In my cakePHP project, on a uploading file, am facing below issue:
pr($resume['tmp_name']);
is returning the file path yet file is not physically present in that location and interestingly if (move_uploaded_file($resume['tmp_name'], 'resumes/'))
is returning true and yet file is not moved to that location.
Note: 'resumes/'
folder is present in same directory of the controller.
Any suggestions? I got to upload two files from that view
Edit: https://stackoverflow.com/a/2618432/1528701 has solved my issue
Upvotes: 0
Views: 249
Reputation: 144
Edit your usercontroller like this
public function property() {
if ($this->request->is('post') || $this->request->is('put')) {
//die();
$file = $this->request->data['Document']['submittedfile'];
//$this->pdfadd1->save($this->request->data);
move_uploaded_file($this->data['Document']['submittedfile']['tmp_name'], $_SERVER['DOCUMENT_ROOT'] . '/cakephp3/cakephp1/cakephp/app/webroot/files/' . $this->data['Document']['submittedfile']['name']);
Upvotes: 1