Are you certain that text2.txt exists in the root of the D drive? Did
you try using the FileExists FSO method to see whether FSO thinks the
file does actually exist?

set fs=Server.CreateObject("Scripting.FileSystemObject")
If fs.FileExists("d:\text2.txt") then
        'do copy
Else
        response.write "File doesn't exist"
End if

If you're 100% certain that the file is there and FSO is reporting that
it's not, then you might want to check the permissions on the file /
drive to see whether IUSR and IWAM have rights.

Dan

-----Original Message-----
From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of Darth Mikey D
Sent: 23 June 2005 10:44
To: [email protected]
Subject: Re: [ASP] Copy a file from a local computer to a web server

Nope. The problem I am having is that it either says the file or path
can't be found. I am pretty sure I have the correct drive and path
correct, but am not sure why it is not working.

I ran the following code to find the drive letters:

        Set FileSystemObject = Server.CreateObject
("Scripting.FileSystemObject") 'Create a filesystem object
        
        Set Drives = FileSystemObject.Drives 'Create a drives collection
        
        'step through the drive collection, and extract
        'the drive letter and the type of drive
        'according to the Microsoft VBScript documentation
        'there are 6 distinct types of drive
        
        For Each DiskDrive in Drives
        
        DriveLetter = DiskDrive.DriveLetter
        DriveType = DiskDrive.DriveType
        
        Select Case DriveType
        Case "0" DriveType = "Unknown type of drive"
        Case "1" DriveType = "Removable drive"
        Case "2" DriveType = "Fixed drive"
        Case "3" DriveType = "Network drive"
        Case "4" DriveType = "CD-ROM drive"
        Case "5" DriveType = "RAM Disk"
        End Select
        
        Response.Write "Drive " & DriveLetter & " is a " & DriveType &
"<BR>"
        
        Next
        
        Set Drives = nothing
        Set FileSystemObject = nothing


This gave me the following:

     Drive A is a Removable drive
     Drive C is a Fixed drive
     Drive D is a Fixed drive
     Drive E is a CD-ROM drive
     Drive J is a Network drive
     Drive K is a Network drive

I tried the fixed and network drive names, but kept receiving a file
can't be found message.

The following is the code I am trying to use to copy the file, but not
sure what the problem is. (Where it says D:\, I replaced that with each
drive name, but none worked):

        set fs=Server.CreateObject("Scripting.FileSystemObject")
        set f=fs.GetFile("D:\text2.txt")
        f.Copy "D:\new_test.txt",false
        set f=nothing
        set fs=nothing


--- In [email protected], "Niels Bieze" 
<[EMAIL PROTECTED]> wrote:
> Wild guess: its a rights-issue, have given the I_USR write-rights
on the
> directory where you wish to put the files?
> 
> > -----Oorspronkelijk bericht-----
> > Van: [email protected] [mailto:active-server- 
> > [EMAIL PROTECTED] Namens Darth Mikey D
> > Verzonden: Thursday, June 23, 2005 10:43 AM
> > Aan: [email protected]
> > Onderwerp: [ASP] Copy a file from a local computer to a web
server
> > 
> > I am typing this while trying to stay awake at work, so bear
with me
> > in case I am not exactly clear. I work at the local hospital in
the IS
> > department, and am working on some web pages for them. I am
trying to
> > create a script that will copy a file from a pc to the web
server, but
> > am not having much luck. I can do it on the pc fine, but when I
try to
> > do it on the server, it is not working. If anyone has any ideas,
that
> > would be great.
> > 
> > 
> > 
> > 
> > 
> > 
> > -----------------------------------------------------------------
----
> >  Home       : http://groups.yahoo.com/group/active-server-pages
> > -----------------------------------------------------------------
----
> >  Post       : [email protected]
> >  Subscribe  : [EMAIL PROTECTED]
> >  Unsubscribe: [EMAIL PROTECTED]
> > -----------------------------------------------------------------
----
> > Yahoo! Groups Links
> > 
> > 
> > 
> >






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

 Home       : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
 Post       : [email protected]
 Subscribe  : [EMAIL PROTECTED]
 Unsubscribe: [EMAIL PROTECTED]
---------------------------------------------------------------------
Yahoo! Groups Links



 




---------------------------------------------------------------------    
 Home       : http://groups.yahoo.com/group/active-server-pages
---------------------------------------------------------------------
 Post       : [email protected]
 Subscribe  : [EMAIL PROTECTED]
 Unsubscribe: [EMAIL PROTECTED]
--------------------------------------------------------------------- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/active-server-pages/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to