Assign NTFS permission information to file upload process

Posted on 2007-10-10
Last Modified: 2008-01-09
I am uploading a file via a website to a webserver. I do not want to use anonymous user to upload the file. How can I assign NTFS permissions to the file upload process so they can write the file to the folder. Here is the code I am using:

<%@ Language=VBScript %>
option explicit
Response.Expires = -1
<!-- #include file="upload.asp" -->
      Dim uploadsDirVar, savedDirVar, copyFile, saveFile
      Dim fs,f
      uploadsDirVar = Server.MapPath("/Files/")
      savedDirVar = Server.MapPath("/ViewFiles/")

function SaveFiles
    Dim Upload, fileName, fileSize, ks, i, fileKey

      Session("filename") = ""
    Set Upload = New ASPUpload

    ks = Upload.UploadedFiles.keys
    if (UBound(ks) <> -1) then
        for each fileKey in Upload.UploadedFiles.keys
            Session("filename") = Upload.UploadedFiles(fileKey).FileName
                  If LEN(Session("Filename")) > 1 Then
                        copyFile = uploadsDirVar & "\" & Session("FileName")
                        saveFile = savedDirVar & "\" & Session("FileName")
                        response.write copyFile & "----" & saveFile & "<br>"
                        Set fs=Server.CreateObject("Scripting.FileSystemObject")
                        Set f=fs.GetFile(copyFile)
                        f.Copy saveFile,true
                        set f=nothing
                        set fs=nothing
                  End if
        SaveFiles = "The file name specified in the upload form does not correspond to a valid file in the system."
    end if

end function

response.redirect ("statlink_add.asp")
Question by:rcmb
    1 Comment
    LVL 20

    Accepted Solution


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
    I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now