Thread: File Uploads

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

    Join Date
    Mar 2000
    Location
    Randolph, NJ
    Posts
    36
    Rep Power
    15
    I have a file upload script. I have everything working fine. But when I test it out I can't find the uploaded file. I looked in /var/tmp/ but nothing of the sort is there. How can I direct the upload to do to a folder of my choice?

    ------------------
    ================
    -Khill, www.tsrealm.com
  2. #2
  3. Full Access
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jun 2000
    Location
    London, UK
    Posts
    2,019
    Rep Power
    17
    Here's what I use:
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
    <?

    copy($file,"/home/www/images/");

    ?>
    [/code]

    where $file is defined by a file input type in a multipart form, like:

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>

    <form method=POST action="upload.php3" enctype="multipart/form-data">

    <input type="file" name="file">

    </form>

    [/code]

    Hope this helps,

    --------------------------------------------
    Alex
    (http://www.alex-greg.co.uk)
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    Randolph, NJ
    Posts
    36
    Rep Power
    15
    Yeah, or in the part that is submitted write

    exec("cp $picture /path/to/images/$picture_name");

    $picture_name is the name of the uploaded picture.....

    thanks anyways Alex-Greg

    ------------------
    ================
    -Khill, www.tsrealm.com
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    0
    Rep Power
    0
    Try this :

    copy($file,"/home/www/images/".$file_name);

    Also check your directory-access-rights.

Similar Threads

  1. Pointer problem in opening a file
    By LAKI in forum C Programming
    Replies: 13
    Last Post: February 11th, 2004, 09:27 AM
  2. Pointer problems opening file *formatted*
    By LAKI in forum C Programming
    Replies: 4
    Last Post: February 11th, 2004, 07:06 AM
  3. Replies: 1
    Last Post: February 8th, 2004, 02:59 PM
  4. PHP file upload script trouble
    By casbboy in forum PHP Development
    Replies: 9
    Last Post: February 5th, 2004, 08:42 PM
  5. Delete file from browser cache
    By CEO in forum Perl Programming
    Replies: 2
    Last Post: January 12th, 2004, 07:57 AM

IMN logo majestic logo threadwatch logo seochat tools logo