Having trouble with FileCopy string

Discussion in 'C#' started by Sleeping Troll, Jul 13, 2008.

  1. #1
    This is my code



     
    
    CpyStr= ImgFile&","&Server.MapPath("../Images/Products/"&ProdID&".png")
     Response.write(CpyStr)
     Set fs=Server.CreateObject("Scripting.FileSystemObject")
     fs.CopyFile CpyStr
     set fs=nothing
    
    
    
    Code (markup):


    I get the following error:



    Wrong number of arguments or invalid property assignment: 'CopyFile'



    This is my string:



    C:\Documents and Settings\ButchTroll\My Documents\HawksNuthouse\images\Products\80008.png,d:\hosting\hawkspeanuts\Images\Products\00120-5.png



    Anybody know what I'm doing wrong?
     
    Sleeping Troll, Jul 13, 2008 IP
  2. seo8k

    seo8k Guest

    Messages:
    70
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    FileSystemObject.CopyFile source,destination[,overwrite]
    parameter "destination" missing
    need more help , you can PM me
     
    seo8k, Jul 13, 2008 IP
  3. ludwig

    ludwig Notable Member

    Messages:
    2,253
    Likes Received:
    66
    Best Answers:
    0
    Trophy Points:
    225
    #3
    Copy a File

    Use the file system operations, Copy is supported by the FileSystemObject object.
    CopyFile source, destination[, overwrite]

    Note : The user must have write permissions to copy a file from one directory to another.

    Delete a File or Files

    Note : The optional parameter for the DeleteFile method is Force.
    This defaults to False, and determines whether or not read-only files will be deleted.
    Only if Force is set to True will read-only files be deleted.

    Append to a File
    Notice the numbers 1,2 and 8 in the above examples. Here is what they represent
    1: Opens file for reading. Cannot write to this file
    2: Opens file for writing. This file can't be read. Writing anything to this file would overwrite the previous contents.
    8: Opens the file for appending. The previous contents is not overwritten.

    Notice the "True" and "False" parameters in examples above
    True: The file will be created if it doesn't exist
    False: A new will not be created if it doesn't already exist.

    Get the filenames in a directory

    Replace "directoryname" with your directory name.
    Note : Replace 'directoryname' with the name od directory you wish to read
    In case of NT the directory mush have read permission for being read from anonymous account

    Move a File or Files

    Use the file system operations, Rename is supported by the FileSystemObject object.
    MoveFile source, destination

    Note : The user must have minimum delete permissions on the source directory
    and write permissions on the destination directory.

    Read a File
    Read ALL


    Notice the numbers 1,2 and 8 in the above examples. Here is what they represent
    1: Opens file for reading. Cannot write to this file
    2: Opens file for writing. This file can't be read. Writing anything to this file would overwrite the previous contents.
    8: Opens the file for appending. The previous contents is not overwritten.

    Notice the "True" and "False" parameters in examples above
    True: The file will be created if it doesn't exist
    False: A new will not be created if it doesn't already exist.

    Write to a File
    Notice the numbers 1,2 and 8 in the above examples. Here is what they represent
    1: Opens file for reading. Cannot write to this file
    2: Opens file for writing. This file can't be read. Writing anything to this file would overwrite the previous contents.
    8: Opens the file for appending. The previous contents is not overwritten.

    Notice the "True" and "False" parameters in examples above
    True: The file will be created if it doesn't exist
    False: A new will not be created if it doesn't already exist.
     
    ludwig, Jul 13, 2008 IP
    dylanj likes this.