Thread: Uploading files

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

    Join Date
    Jun 2000
    Posts
    2
    Rep Power
    0
    Im want to be able to upload word documents and im using the script below. However its not working and the error message shown below
    is displayed.

    Whats wrong?

    This is the HTML for the form:


    <FORM ENCTYPE="multipart/form-data" ACTION="upload.php" METHOD=POST>
    <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="100000">
    <input type="File" name="file" size="30" maxlength="255">
    <INPUT TYPE="submit" VALUE="upload">

    This is the php script upload.php:


    <?php

    if(copy($file, "/big/dom/xsuntopuser/www/files/$file_name"))

    {
    print("document has been uploaded");
    }
    else
    {
    print("document not copied");
    }

    ?>

    This is the error message displayed:

    Warning: Unable to create '/big/dom/xsuntopuser/www/files/Rosscv.doc': Permission denied in /big/dom/xsuntopuser/www/add_upload.php on line 31
    document not copied
    upload report
    upload tmp file: /big/dom/tmp/phpxRP5LY
    file name:
    file size: 23040
    file type: application/msword

    Hope you can Help
    Cheers
    Damon
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    2
    Rep Power
    0
    You may want to check the permissions on the directory you are trying to upload to. You have to have write permissions on that directory.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Location
    MO, US
    Posts
    119
    Rep Power
    15
    what is the scripting of "add_upload.php"?
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    2
    Rep Power
    0
    Cheers People

    I didnt have write permissions to the required directory but ive got it sorted now and it works fine.

    Thanks for your time
    Damon
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    6
    Rep Power
    0
    I copy murf's script to upload file
    However it is not working

    Here is the error message:

    Warning: Unable to open 'php2' for reading: No such file or directory in chpdevwwwupload.php3 on line 3
    document not copied

    Can anyone help me.
    Thanks
    Matchau

  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    24
    Rep Power
    0
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Warning: Unable to open 'php2' for reading: No such file or directory in chpdevwwwupload.php3 on line 3
    [/quote]

    You need to get rid of that in the php2 file name. It seem your on windows and i had the same problem with my scripts. I think the stripslashes() function will work for this

    ex. copy(stripslashes($file),"/dir/file");

    I never really tried it cuz i just turned on the magic_quotes option
  12. #7
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Posts
    6
    Rep Power
    0
    I get rid of all the stuff in the upload_tmp_dir (php.ini) and I replace by a dot .

    Now it is working fine
    Thanks
    Matchau

Similar Threads

  1. Uploading Files
    By vivekjain in forum ASP Programming
    Replies: 0
    Last Post: February 16th, 2004, 11:21 PM
  2. Security issues with uploading image files
    By paulc218 in forum PHP Development
    Replies: 4
    Last Post: January 26th, 2004, 12:03 PM
  3. uploading files and checking extention
    By tim0 in forum Perl Programming
    Replies: 3
    Last Post: January 19th, 2004, 12:27 AM
  4. uploading files to folder vs. db
    By joepopovich in forum PHP Development
    Replies: 1
    Last Post: December 20th, 2003, 07:34 PM
  5. file uploading.. 0 file(s) uploaded
    By zingzee in forum Java Help
    Replies: 1
    Last Post: December 16th, 2003, 08:51 AM

IMN logo majestic logo threadwatch logo seochat tools logo