Skip to main content

I just want to upload a single pdf file using cakephp, here is my view called pdfadd.ctp:

<?php echo $this->Form->create('pdfadd1', array('enctype' => 'multipart/form-data'));?> <fieldset> <?php <?php  echo $this->Form->file('Document.submittedfile'); ?> </fieldset> <?php echo $this->Form->end(__('Submit'));?> 

Here is my conroller:

 public function pdfadd(){   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'] . '/app/webroot/files/' . $this->data['Document']['submittedfile']['name']);   } 

It gives me this error:

Warning (2): move_uploaded_file(D:/Program Files D/xampp/htdocs/app/webroot/files/Functions Package for email (1).pdf): failed to open stream: No such file or directory [APP\Controller\PagesController.php, line 29] Warning (2): move_uploaded_file() [function.move-uploaded-file]: Unable to move 'D:\Program Files D\xampp\tmp\php862.tmp' to 'D:/Program Files D/xampp/htdocs/app/webroot/files/Functions Package for email (1).pdf' [APP\Controller\PagesController.php, line 29] 

And also I want to rename the file to 1.pdf. The file should save in webroot/files.

I just want to upload a single pdf file using cakephp, here is my view called pdfadd.ctp:

<?php echo $this->Form->create('pdfadd1', array('enctype' => 'multipart/form-data'));?> <fieldset> <?php echo $this->Form->file('Document.submittedfile'); ?> </fieldset> <?php echo $this->Form->end(__('Submit'));?> 

Here is my conroller:

 public function pdfadd(){   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'] . '/app/webroot/files/' . $this->data['Document']['submittedfile']['name']);   } 

It gives me this error:

Warning (2): move_uploaded_file(D:/Program Files D/xampp/htdocs/app/webroot/files/Functions Package for email (1).pdf): failed to open stream: No such file or directory [APP\Controller\PagesController.php, line 29] Warning (2): move_uploaded_file() [function.move-uploaded-file]: Unable to move 'D:\Program Files D\xampp\tmp\php862.tmp' to 'D:/Program Files D/xampp/htdocs/app/webroot/files/Functions Package for email (1).pdf' [APP\Controller\PagesController.php, line 29] 

And also I want to rename the file to 1.pdf. The file should save in webroot/files.

I just want to upload a single pdf file using cakephp, here is my view called pdfadd.ctp:

<?php echo $this->Form->create('pdfadd1', array('enctype' => 'multipart/form-data'));?> <fieldset> <?php  echo $this->Form->file('Document.submittedfile'); ?> </fieldset> <?php echo $this->Form->end(__('Submit'));?> 

Here is my conroller:

 public function pdfadd(){ 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'] . '/app/webroot/files/' . $this->data['Document']['submittedfile']['name']); } 

It gives me this error:

Warning (2): move_uploaded_file(D:/Program Files D/xampp/htdocs/app/webroot/files/Functions Package for email (1).pdf): failed to open stream: No such file or directory [APP\Controller\PagesController.php, line 29] Warning (2): move_uploaded_file() [function.move-uploaded-file]: Unable to move 'D:\Program Files D\xampp\tmp\php862.tmp' to 'D:/Program Files D/xampp/htdocs/app/webroot/files/Functions Package for email (1).pdf' [APP\Controller\PagesController.php, line 29] 

And also I want to rename the file to 1.pdf. The file should save in webroot/files.

fix grammar and error formatting
Source Link
marko
  • 9.2k
  • 4
  • 35
  • 47

I just want to upload a single pdf file using cakephp, here is my view called pdfadd.ctppdfadd.ctp:

<?php echo $this->Form->create('pdfadd1', array('enctype' => 'multipart/form-data'));?> <fieldset> <?php echo $this->Form->file('Document.submittedfile'); ?> </fieldset> <?php echo $this->Form->end(__('Submit'));?> 

Here is my conroller:

 public function pdfadd(){ 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'] . '/app/webroot/files/' . $this->data['Document']['submittedfile']['name']); } 

It gives me this error:

Warning (2): move_uploaded_file(D:/Program Files D/xampp/htdocs/app/webroot/files/Functions Package for email (1).pdf): failed to open stream: No such file or directory [APP\Controller\PagesController.php, line 29] Warning (2): move_uploaded_file() [function.move-uploaded-file]: Unable to move 'D:\Program Files D\xampp\tmp\php862.tmp' to 'D:/Program Files D/xampp/htdocs/app/webroot/files/Functions Package for email (1).pdf' [APP\Controller\PagesController.php, line 29] 

And also I wanwant to rename the file to 1.pdf1.pdf. The file should save in webroot/fileswebroot/files.

I just want to upload a single pdf file using cakephp, here is my view called pdfadd.ctp:

<?php echo $this->Form->create('pdfadd1', array('enctype' => 'multipart/form-data'));?> <fieldset> <?php echo $this->Form->file('Document.submittedfile'); ?> </fieldset> <?php echo $this->Form->end(__('Submit'));?> 

Here is my conroller:

 public function pdfadd(){ 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'] . '/app/webroot/files/' . $this->data['Document']['submittedfile']['name']); } 

It gives me this error:

Warning (2): move_uploaded_file(D:/Program Files D/xampp/htdocs/app/webroot/files/Functions Package for email (1).pdf): failed to open stream: No such file or directory [APP\Controller\PagesController.php, line 29] Warning (2): move_uploaded_file() [function.move-uploaded-file]: Unable to move 'D:\Program Files D\xampp\tmp\php862.tmp' to 'D:/Program Files D/xampp/htdocs/app/webroot/files/Functions Package for email (1).pdf' [APP\Controller\PagesController.php, line 29] 

And also I wan to rename the file to 1.pdf. The file should save in webroot/files.

I just want to upload a single pdf file using cakephp, here is my view called pdfadd.ctp:

<?php echo $this->Form->create('pdfadd1', array('enctype' => 'multipart/form-data'));?> <fieldset> <?php echo $this->Form->file('Document.submittedfile'); ?> </fieldset> <?php echo $this->Form->end(__('Submit'));?> 

Here is my conroller:

 public function pdfadd(){ 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'] . '/app/webroot/files/' . $this->data['Document']['submittedfile']['name']); } 

It gives me this error:

Warning (2): move_uploaded_file(D:/Program Files D/xampp/htdocs/app/webroot/files/Functions Package for email (1).pdf): failed to open stream: No such file or directory [APP\Controller\PagesController.php, line 29] Warning (2): move_uploaded_file() [function.move-uploaded-file]: Unable to move 'D:\Program Files D\xampp\tmp\php862.tmp' to 'D:/Program Files D/xampp/htdocs/app/webroot/files/Functions Package for email (1).pdf' [APP\Controller\PagesController.php, line 29] 

And also I want to rename the file to 1.pdf. The file should save in webroot/files.

file File upload using cakephp

I just want to upload a single pdf file using cakephp, here is my view called pdfadd.ctp:

<?php echo $this->Form->create('pdfadd1', array('enctype' => 'multipart/form-data'));?> <fieldset> <?php echo $this->Form->file('Document.submittedfile'); ?> </fieldset> <?php echo $this->Form->end(__('Submit'));?> 

Here is my conroller:

 public function pdfadd(){ 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'] . '/app/webroot/files/' . $this->data['Document']['submittedfile']['name']); } 

It gives me this error

Warning (2): move_uploaded_file(D:/Program Files D/xampp/htdocs/app/webroot/files/Functions Package for email (1).pdf): failed to open stream: No such file or directory [APP\Controller\PagesController.php, line 29] Warning (2): move_uploaded_file() [function.move-uploaded-file]: Unable to move 'D:\Program Files D\xampp\tmp\php862.tmp' to 'D:/Program Files D/xampp/htdocs/app/webroot/files/Functions Package for email (1).pdf' [APP\Controller\PagesController.php, line 29]

Warning (2): move_uploaded_file(D:/Program Files D/xampp/htdocs/app/webroot/files/Functions Package for email (1).pdf): failed to open stream: No such file or directory [APP\Controller\PagesController.php, line 29] Warning (2): move_uploaded_file() [function.move-uploaded-file]: Unable to move 'D:\Program Files D\xampp\tmp\php862.tmp' to 'D:/Program Files D/xampp/htdocs/app/webroot/files/Functions Package for email (1).pdf' [APP\Controller\PagesController.php, line 29] 

And asloalso I wantowan to rename the file asto 1.pdf always. The file should save in webroot/files.

please Help

file upload using cakephp

I just want to upload a single pdf file using cakephp, here is my view called pdfadd.ctp:

<?php echo $this->Form->create('pdfadd1', array('enctype' => 'multipart/form-data'));?> <fieldset> <?php echo $this->Form->file('Document.submittedfile'); ?> </fieldset> <?php echo $this->Form->end(__('Submit'));?> 

Here is my conroller:

 public function pdfadd(){ 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'] . '/app/webroot/files/' . $this->data['Document']['submittedfile']['name']); } 

It gives me this error

Warning (2): move_uploaded_file(D:/Program Files D/xampp/htdocs/app/webroot/files/Functions Package for email (1).pdf): failed to open stream: No such file or directory [APP\Controller\PagesController.php, line 29] Warning (2): move_uploaded_file() [function.move-uploaded-file]: Unable to move 'D:\Program Files D\xampp\tmp\php862.tmp' to 'D:/Program Files D/xampp/htdocs/app/webroot/files/Functions Package for email (1).pdf' [APP\Controller\PagesController.php, line 29]

And aslo I wanto rename the file as 1.pdf always. The file should save in webroot/files.

please Help

File upload using cakephp

I just want to upload a single pdf file using cakephp, here is my view called pdfadd.ctp:

<?php echo $this->Form->create('pdfadd1', array('enctype' => 'multipart/form-data'));?> <fieldset> <?php echo $this->Form->file('Document.submittedfile'); ?> </fieldset> <?php echo $this->Form->end(__('Submit'));?> 

Here is my conroller:

 public function pdfadd(){ 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'] . '/app/webroot/files/' . $this->data['Document']['submittedfile']['name']); } 

It gives me this error:

Warning (2): move_uploaded_file(D:/Program Files D/xampp/htdocs/app/webroot/files/Functions Package for email (1).pdf): failed to open stream: No such file or directory [APP\Controller\PagesController.php, line 29] Warning (2): move_uploaded_file() [function.move-uploaded-file]: Unable to move 'D:\Program Files D\xampp\tmp\php862.tmp' to 'D:/Program Files D/xampp/htdocs/app/webroot/files/Functions Package for email (1).pdf' [APP\Controller\PagesController.php, line 29] 

And also I wan to rename the file to 1.pdf. The file should save in webroot/files.

Source Link
Loading