Posted by: ranacse05 on: February 23, 2008
Hello everybody here is a upload script by php.using this script u can upload file in the server.This is not that tough script.But for beginners its important.:)
index.php file
[FORM ENCTYPE="multipart/form-data" ACTION="uploadck.php" METHOD=POST]
Upload this file: [INPUT NAME="file_up" TYPE="file][INPUT TYPE="submit" VALUE="Send File [/FORM]
uploader.php
$file_upload=”true”;
echo $_FILES[file_up][name];
$file_name=$_FILES[file_up][name];
$add=”upload/$file_name”; // the path with the file name where the file will be stored, upload is the directory name.
if(move_uploaded_file ($_FILES[file_up][tmp_name], $add)){
// do your coding here to give a thanks message or any other thing.
}
else{echo “Failed to upload file Contact Site admin to fix the problem”;}
i tried program but it shows following error
Fatal error: Uncaught exception ‘Zend_File_Transfer_Exception’ with message ‘”doc_path” not found by file transfer adapter’ in C:\wamp\www\jplnews\library\Zend\File\Transfer\Adapter\Abstract.php:1254 Stack trace: #0 C:\wamp\www\jplnews\library\Zend\File\Transfer\Adapter\Abstract.php(572): Zend_File_Transfer_Adapter_Abstract->_getFiles(‘doc_path’) #1 C:\wamp\www\jplnews\library\Zend\Form\Element\File.php(435): Zend_File_Transfer_Adapter_Abstract->isValid(‘doc_path’) #2 C:\wamp\www\jplnews\library\Zend\Form.php(1985): Zend_Form_Element_File->isValid(NULL, Array) #3 C:\wamp\www\jplnews\application\default\controllers\ForController.php(22): Zend_Form->isValid(Array) #4 C:\wamp\www\jplnews\library\Zend\Controller\Action.php(503): ForController->indexAction() #5 C:\wamp\www\jplnews\library\Zend\Controller\Dispatcher\Standard.php(285): Zend_Controller_Action->dispatch(‘indexAction’) #6 C:\wamp\www\jplnews\library\Zend\Controller\Front.php(934): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), O in C:\wamp\www\jplnews\library\Zend\File\Transfer\Adapter\Abstract.php on line 1254
then plz what can i do?
how to upload file in cakephp1.2
March 6, 2008 at 6:17 pm
your page is very helpful. anyone can get help from u r site. thanks for this kind of site.
bye