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

    Join Date
    Jun 2000
    Location
    London, England
    Posts
    64
    Rep Power
    15
    I'm new to PHP and want to upload files to a web server. At the mo I'm testing it on my home PC.

    This is the HTML and the PHP i am using:

    HTML code:

    <Form Enctype="multipart/form-data" ACTION="upload3.php" method="post">
    <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="4096">
    <input name="uploadedfile" type="file">
    <input type="Submit" value="upload">

    PHP code:

    <?

    $uploadedfile = stripslashes($uploadedfile);

    if (isset($uploadedfile))
    {
    $path1 = "http://localhost/Gareth/";
    $dest = $path1 . $uploadedfile_name;
    copy($uploadedfile, "$dest");

    print ("The uploaded path is $dest<br>n");

    print ("Local File: $uploadedfile <br>n");
    print ( "name: $uploadedfile_name <br>n");
    print ( "Size: $uploadedfile_size <br>n");
    print ( "Type: $uploadedfile_type <br>n");
    print ("<HR>n");

    }
    else

    ?>

    This is what is returned to me.

    Warning: Unable to create 'http://localhost/Gareth/apache_pb.doc': No such process in C:Program FilesApache GroupApachehtdocs/Gareth/upload3.php on line 16
    The uploaded path is http://localhost/Gareth/apache_pb.gif
    Local File: php2
    name: apache_pb.doc
    Size: 2326
    Type: MSApplication/doc

    Anyone had similar problems...?
  2. #2
  3. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,648
    Rep Power
    4493
    Doesn't the path where you are trying to copy the file to have to be an actual path, such as

    c:garethupload.doc

    instead of an http path.

    hope that is clear...

    ---John Holmes
    ---www.SepodatiCreations.com
  4. #3
  5. No Profile Picture
    Dave Bryant
    Guest
    Devshed Newbie (0 - 499 posts)
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by SepodatiCreations:
    [B]Doesn't the path where you are trying to copy the file to have to be an actual path, such as

    c:garethupload.doc


    Warning: Unable to create 'http://localhost/Gareth/apache_pb.doc': No such process in C:Program FilesApacheGroupApachehtdocs/Gareth/upload3.php on line 16
    [/quote]

    It is instantly clear from the error it goes from forward slashes to backslashes ( you have a file directory convention problem) try putting the absolute path using the backslashes instead of the forward slashes as previously suggested.

    ------------------

Similar Threads

  1. php script won't work inside "cgi-local" directory
    By Volitics in forum PHP Development
    Replies: 5
    Last Post: April 26th, 2004, 11:50 PM
  2. How to see the Memory used by a PHP script?
    By Pardall in forum PHP Development
    Replies: 4
    Last Post: February 13th, 2004, 04:54 PM
  3. PHP file upload script trouble
    By casbboy in forum PHP Development
    Replies: 9
    Last Post: February 5th, 2004, 08:42 PM
  4. Replies: 1
    Last Post: February 4th, 2004, 02:39 PM
  5. simplest php upload script
    By frazzle in forum PHP Development
    Replies: 3
    Last Post: January 31st, 2004, 05:32 PM

IMN logo majestic logo threadwatch logo seochat tools logo