Skip to content
February 23, 2008 / ranacse05

Upload File to the Server


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”;}

Advertisements

11 Comments

Leave a Comment
  1. kishor / Mar 6 2008 6:17 pm

    your page is very helpful. anyone can get help from u r site. thanks for this kind of site.
    bye

  2. fosilt / Mar 26 2008 5:11 am

    i’m newbie, how i write that script to my wordpress.
    thanx

  3. ranacse05 / Mar 26 2008 5:24 am

    @fosilt
    Actually what u wanna do ? If u wanna change ur WP theme uploading the files then u have to pay WP for that.

  4. fosilt / Mar 27 2008 5:05 am

    no, i just wanna to upload my php script, not WP theme?
    so?
    thanx

  5. ranacse05 / Mar 27 2008 9:36 am

    @fosilt
    Please contact with WP team about it.I donno 😦

  6. nitin / Mar 20 2009 11:55 am

    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?

  7. mohd rashid / Sep 7 2009 8:48 am

    how to upload file in cakephp1.2

  8. primardie / May 24 2010 3:52 am

    Ok…so what you are saying is that in order to make changes to the themes we must therefore contact wordpress. Don’t you have to have a hosting service such as startlogic or other to upload a php file?

    • ranacse05 / May 24 2010 10:14 am

      yes.

  9. primardie / May 24 2010 3:52 am

    I want to add adsense ads to my site and I can’t. Why is that?

    • ranacse05 / May 24 2010 10:15 am

      u can add adsense code , just add a text box from and then paste the adsense code there .

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: