#1
  1. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jan 2017
    Posts
    745
    Rep Power
    0

    Why Uploading A File's Data To Another File Fails ?


    Php Buddies,

    I am trying to upload notices.php data to output_upload.php. But, I get error.

    upload.php
    PHP Code:

    $url 
    "http://localhost/meta_engine/output_upload.php";
     
    //When you want to upload a file, all you have to do is pass its file path just like a post variable, and put the @ symbol in front of it. 
    $post_data = array (
        
    "foo" => "bar",
        
    // file to be uploaded
        
    "upload" => "@C:/local_host/test/notices.php"
    );
     
    $ch curl_init();
     
    curl_setopt($chCURLOPT_URL$url);
     
    curl_setopt($chCURLOPT_RETURNTRANSFER1);
     
    curl_setopt($chCURLOPT_POST1);
     
    curl_setopt($chCURLOPT_POSTFIELDS$post_data);
     
    $output curl_exec($ch);
     
    curl_close($ch);
     
    echo 
    $output;

    ?> 
    output_upload.php
    PHP Code:
    <?php 

    print_r
    ($_FILES);

    ?>
    Error I see on output_upload.php is:

    Object not found!
    The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

    If you think this is a server error, please contact the webmaster.

    Error 404
    localhost
    Apache/2.4.23 (Win32) OpenSSL/1.0.2h PHP/7.0.9



    What am I doing wrong and where ?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jul 2003
    Posts
    4,436
    Rep Power
    652
    The error explains it quite well. The requested URL was not found on this server.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jan 2017
    Posts
    745
    Rep Power
    0
    Originally Posted by gw1500se
    The error explains it quite well. The requested URL was not found on this server.
    Problem is, url is present on the server. And so, should not get the error.
  6. #4
  7. Impoverished Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,744
    Rep Power
    9646
    No, it is not present. You are mistaken about something.

IMN logo majestic logo threadwatch logo seochat tools logo