#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    8
    Rep Power
    0
    This is my problem. I have made this form where a user can upload a picture to this directory on the internet.
    The directory lets say is http://www.bogus.com/images . Now this directory does exist but when i submit an error
    occurs which says : Unable to create 'http://www.bogus.com/images/': No such file or directory

    What does that mean? Here is my code so you can tell me what i'm doing wrong.


    <html>
    <form action="upload.php3" method="post" enctype="multipart/form-data">
    submit this file :

    <input type="hidden" name="max_file_size" value="30000">

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

    <input type =submit><br>
    </form>
    </htm


    ####UPLOAD.php3 #######
    #################
    <?


    if (copy($userfile, "http://www.bogus.com/images/")) {

    echo ("SUCCESS");
    }else{
    echo("defeat");
    }


    ?>
  2. #2
  3. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,642
    Rep Power
    4492
    copy(source,dest)

    You have to give the whole filename in each. Just give the path to where you want to store it, not the http://

    Assuming your running www.bogus.com/upload.php3, then you'd use this:

    copy($userfile,"images/".$userfile_name);

    $userfile_name is the original name of the file on the users system. This would work, too, assuming they upload a .jpg

    copy($userfile,"images/pic0001.jpg");

    The path in the destination is dependant on where the upload.php3 file is running. Hope that helps.

    ---John Holmes...
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    8
    Rep Power
    0


    Dear John

    What i forgot to tell you was that i'm running the script from my server not on the net.So my upload.php3 is on my Xitami and not on www.bogus.com/upload.php3.
    I just wanted to know how to make it send a pic from down here to up there. The URL does exist(that is the http://www.bogus.com/images)
    So if i just put "/images/". $userfile etc
    it wont know what i'm talking about right?
    can you help?
    thanks

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by SepodatiCreations:
    copy(source,dest)

    You have to give the whole filename in each. Just give the path to where you want to store it, not the http://

    Assuming your running www.bogus.com/upload.php3, then you'd use this:

    copy($userfile,"images/".$userfile_name);

    $userfile_name is the original name of the file on the users system. This would work, too, assuming they upload a .jpg

    copy($userfile,"images/pic0001.jpg");

    The path in the destination is dependant on where the upload.php3 file is running. Hope that helps.

    ---John Holmes...
    [/quote]

  6. #4
  7. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,642
    Rep Power
    4492
    Just use absolute or relative paths in your copy command.

    if you're running upload.php3 from your web root, and images is a diretory directly under your web root, then this will work.

    copy($userfile,"images/".$userfile_name);

    Is Xitami under windows or *nix? either way you can use the forward slashes.

    /home/user/htdocs/upload.php3
    /home/user/htdocs/images/...
    copy($userfile,"/home/user/htdocs/images/".$userfile_name);

    C:httpdhtdocsupload.php3
    C:httpdhtdocsimages...
    copy($userfile,"/httpd/htdocs/images/".$userfile_name);

    Also, you might have to play with the permissions of the images directory so that PHP has permissions to write files there.

    ---John Holmes...
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    8
    Rep Power
    0
    Johnny boy you got balls the size of church-bells.
    It worked fine. Thanks a lot man.

    ps you know there's a site about holmes including his size,no. of women etc

Similar Threads

  1. upload and resize images transparently
    By pcgamez in forum PHP Development
    Replies: 1
    Last Post: February 14th, 2004, 07:32 PM
  2. Replies: 3
    Last Post: January 27th, 2004, 12:27 AM
  3. alterning filename during upload
    By bramsey in forum .Net Development
    Replies: 5
    Last Post: November 21st, 2003, 10:35 AM
  4. Help with a script to allow users to upload images to my site
    By julieowen24 in forum Perl Programming
    Replies: 1
    Last Post: October 1st, 2003, 02:55 PM
  5. Upload images into ENDHTML statement
    By Job4Suprmn in forum JavaScript Development
    Replies: 3
    Last Post: September 3rd, 2003, 01:44 PM

IMN logo majestic logo threadwatch logo seochat tools logo