WTF?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dave Mennenoh

    WTF?

    Can anyone explain to me what I'm doing wrong here?

    These three lines are my upload script. As it's shown here it works - except
    that I'm not using the $folder variable, which I need. I just have the
    folder hardcoded within the line that assigns $moveTo.

    $folder = $_POST['folder'];
    $moveTo = "portfolio/bay_website/".$_FILES['Filedata']['name'];
    move_uploaded_f ile($_FILES['Filedata']['tmp_name'], $moveTo);

    If I now break out "portfolio/bay_website/" to a variable, and use that it
    stops working:

    $folder = $_POST['folder'];
    $d = "portfolio/bay_website/";
    $moveTo = $d.$_FILES['Filedata']['name'];
    move_uploaded_f ile($_FILES['Filedata']['tmp_name'], $moveTo);

    How is this different from the first one? I cannot figure this out, and it's
    why using my $folder variable is not working... Ultimately I simply want
    this:

    $folder = $_POST['folder'];
    move_uploaded_f ile($_FILES['Filedata']['tmp_name'],
    $folder.$_FILES['Filedata']['name']);


    --
    Dave -




  • Jerry Stuckle

    #2
    Re: WTF?

    Dave Mennenoh wrote:[color=blue]
    > Can anyone explain to me what I'm doing wrong here?
    >
    > These three lines are my upload script. As it's shown here it works - except
    > that I'm not using the $folder variable, which I need. I just have the
    > folder hardcoded within the line that assigns $moveTo.
    >
    > $folder = $_POST['folder'];
    > $moveTo = "portfolio/bay_website/".$_FILES['Filedata']['name'];
    > move_uploaded_f ile($_FILES['Filedata']['tmp_name'], $moveTo);
    >
    > If I now break out "portfolio/bay_website/" to a variable, and use that it
    > stops working:
    >
    > $folder = $_POST['folder'];
    > $d = "portfolio/bay_website/";
    > $moveTo = $d.$_FILES['Filedata']['name'];
    > move_uploaded_f ile($_FILES['Filedata']['tmp_name'], $moveTo);
    >
    > How is this different from the first one? I cannot figure this out, and it's
    > why using my $folder variable is not working... Ultimately I simply want
    > this:
    >
    > $folder = $_POST['folder'];
    > move_uploaded_f ile($_FILES['Filedata']['tmp_name'],
    > $folder.$_FILES['Filedata']['name']);
    >
    >[/color]

    Dave,

    Well, to start with, I don't see where you're using $folder anywhere
    once you've gotten it from $_POST['folder']. Maybe you want instead

    $moveTo = $folder.$_FILES['Filedata']['name'];

    If this doesn't work, what do you get? And what's in $folder?

    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • Dave Mennenoh

      #3
      Re: WTF?

      If you note my third code snippet, you'll see I use $folder there - it's
      what I ultimately do want. You can forget $folder in the first two examples
      really...
      And $folder would contain something like I have hardcoded:
      'portfolio/bay_website/'


      --
      Dave -




      Comment

      • Jerry Stuckle

        #4
        Re: WTF?

        Dave Mennenoh wrote:[color=blue]
        > If you note my third code snippet, you'll see I use $folder there - it's
        > what I ultimately do want. You can forget $folder in the first two examples
        > really...
        > And $folder would contain something like I have hardcoded:
        > 'portfolio/bay_website/'
        >
        >[/color]

        OK, I was referring to the first two.

        Again - EXACTLY what is in $folder? i.e.

        echo :folder = " . $folder . "<br>\n";

        --
        =============== ===
        Remove the "x" from my email address
        Jerry Stuckle
        JDS Computer Training Corp.
        jstucklex@attgl obal.net
        =============== ===

        Comment

        • Jerry Stuckle

          #5
          Re: WTF?

          Jerry Stuckle wrote:[color=blue]
          > Dave Mennenoh wrote:
          >[color=green]
          >> If you note my third code snippet, you'll see I use $folder there -
          >> it's what I ultimately do want. You can forget $folder in the first
          >> two examples really...
          >> And $folder would contain something like I have hardcoded:
          >> 'portfolio/bay_website/'
          >>
          >>[/color]
          >
          > OK, I was referring to the first two.
          >
          > Again - EXACTLY what is in $folder? i.e.
          >
          > echo :folder = " . $folder . "<br>\n";
          >[/color]

          That should be:

          echo "folder = " . $folder . "<br>\n";

          --
          =============== ===
          Remove the "x" from my email address
          Jerry Stuckle
          JDS Computer Training Corp.
          jstucklex@attgl obal.net
          =============== ===

          Comment

          Working...