#1
  1. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jan 2004
    Location
    Budapest
    Posts
    1,703
    Rep Power
    67

    CopyFile not working...


    I have a website on a Godaddy shared hosting account. On a page I have this code

    Code:
    <% 
    dim filesys
    set filesys=CreateObject("Scripting.FileSystemObject")
    source = Server.mapPath("../images/local-directory/temp.jpg") 
    destination = Server.mapPath("../images/local-directory/21") 
    If filesys.FileExists(source) Then
    
    filesys.CopyFile(source, destination)
    
    End If
    %>
    If open this page I get a Server 500 error. If I remove the filesys.CopyFile from within the If statement and put a redirect instead it works, telling me the file does exist. But not sure the right syntax for the CopyFile
    Today the world, tomorrow the universe...
  2. #2
  3. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,428
    Rep Power
    4539
    Does godaddy provide the filesystem object? A lot of hosts used to block the fso because of security concerns.

    Somewhere in the msdn library scripting documentation is the reference documentation for the filesystem object.
    ======
    Doug G
    ======
    The man who doesn't read good books has no advantage over the man who can't read them.
    --Mark Twain
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jan 2004
    Location
    Budapest
    Posts
    1,703
    Rep Power
    67
    I believe that Godaddy does support fso as I have this code that works and creates directories.
    Code:
    Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
    folder = Server.mapPath("../../shops") & "/" & session("owner") & "/" & Session("directory") 
    objFSO.CreateFolder(folder)
    folder = Server.mapPath("../../shops") & "/" & session("owner") & "/" & Session("directory")& "/thumbs" 
    objFSO.CreateFolder(folder)
    Set objFSO = Nothing
    Originally Posted by Doug G
    Does godaddy provide the filesystem object? A lot of hosts used to block the fso because of security concerns.

    Somewhere in the msdn library scripting documentation is the reference documentation for the filesystem object.
    Today the world, tomorrow the universe...
  6. #4
  7. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,428
    Rep Power
    4539
    If it helps here's the reference for the CopyFile method

    http://msdn.microsoft.com/en-us/libr...=vs.84%29.aspx

    Also turn off show friendly http errors in your browser and see if you then get the actual error message. And check that your web server has write permission to the target directory.
    ======
    Doug G
    ======
    The man who doesn't read good books has no advantage over the man who can't read them.
    --Mark Twain
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jan 2004
    Location
    Budapest
    Posts
    1,703
    Rep Power
    67
    Hello Doug, I was able to see the actual error message:


    Microsoft VBScript runtime
    error '800a0046'
    Permission denied
    /mydomain.com/copy.asp, line 26


    I logged into GoDaddy's hosting control panel and set permissions on the directory in question but still get this error. Any thoughts?





    Originally Posted by Doug G
    If it helps here's the reference for the CopyFile method

    http://msdn.microsoft.com/en-us/libr...=vs.84%29.aspx

    Also turn off show friendly http errors in your browser and see if you then get the actual error message. And check that your web server has write permission to the target directory.
    Today the world, tomorrow the universe...

IMN logo majestic logo threadwatch logo seochat tools logo