#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    25
    Rep Power
    0

    upload to a directory


    Hi Guys,

    Im having trouble with this,

    Im trying to upload to a directory and cant seem to get the image to go in the directoty, however it will go outside the directory...

    the directory is specified using a database value...

    PHP Code:
    move_uploaded_file($tmp_name"uploads/".$row[10]."{$_FILES['filesxxx']['name'][$key]}"); 
  2. #2
  3. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,908
    Rep Power
    6352
    Print out this value to see if it's valid. You've given us a single line of code with 4 variables in it that you've created. Are any of them right? Only you can say.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  4. #3
  5. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,180
    Rep Power
    9398
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    25
    Rep Power
    0
    Sorry your right.. I will post the full segment tommorrow... and try the full writable permissions see if that helps. I thought it was going to be the way I have written it as it posts to the above directory...
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    25
    Rep Power
    0
    Full segment -

    PHP Code:
    <?php

    if (isset($_FILES['filesxxx'])){
    foreach (
    $_FILES['filesxxx']['tmp_name'] as $key => $tmp_name){
    move_uploaded_file($tmp_name'uploads/'.$row[10]."{$_FILES['filesxxx']['name'][$key]}");

    }
    }
    ?>
    The PHP is above the HTML

    PHP Code:
    <form action="" method="post" enctype="multipart/form-data">
        <
    input type="file" name="filesxxx[]" multiple="multiple" />

        <
    input type="submit" value="Upload" />
    </
    form
    the HTML is obviously in the HTML.


    I have tried the permissions but didnt think it would be this which its not as it write to the above directory.

    on this page, the data base value is called in another location and it outputs fine.
  10. #6
  11. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,908
    Rep Power
    6352
    You still haven't done what I suggested: Print these values to see if they're valid. You don't know if this target location is actually what you think it is.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    25
    Rep Power
    0
    Sorry, Meant to come back... I have managed to fix the problem, i was missing a / and more to the point... I was missing the mysql.... although i checked it was there several times, it wouldnt work so i re wrote it...

IMN logo majestic logo threadwatch logo seochat tools logo