PHP Upload between http & https Not working

Discussion in 'PHP' started by Ian, Oct 15, 2008.

  1. #1
    I have a site located at:

    http://www.mysite.com/file/

    I have the administration section located at:

    https://www.mysite.com/admin

    In the admin section I have an area to upload files, but I want them to load into the http://www.mysite.com/file/ folder, which is located on the http side, not the secured section.

    But I continue to get an error doing so.

    Here's the code:

    <?

    $target = "/home/httpd/vhosts/mysite.com/httpdocs/file/";
    $target = $target . basename( $_FILES['uploaded']['name']) ;

    $name = basename($_FILES['uploaded']['name']);

    if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
    {
    echo "Your File: ". basename( $_FILES['uploadedfile']['name']). " has been uploaded.";
    }
    else {
    echo "Upload Failed.";
    }
    ?>

    It works just fine when it's in the non-secure portion, it just can't post accross for some reason. However, I don't want to have to post from the secure area into the non-secure area, as I'm sure there's just something I'm missing.

    Thanks in advance and I appreciate whatever assistance anyone can give.

    Ian
     
    Ian, Oct 15, 2008 IP
  2. EricBruggema

    EricBruggema Well-Known Member

    Messages:
    1,740
    Likes Received:
    28
    Best Answers:
    13
    Trophy Points:
    175
    #2
    Try using print_r to view the content of $target! :)
     
    EricBruggema, Oct 15, 2008 IP