Assign NTFS permission information to file upload process

Posted on 2007-10-10
Medium Priority
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

Gawai earned 2000 total points
ID: 20050805

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

840 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