rcmb
asked on
Assign NTFS permission information to file upload process
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
Upload.Save(uploadsDirVar)
ks = Upload.UploadedFiles.keys
if (UBound(ks) <> -1) then
for each fileKey in Upload.UploadedFiles.keys
Session("filename") = Upload.UploadedFiles(fileK ey).FileNa me
If LEN(Session("Filename")) > 1 Then
copyFile = uploadsDirVar & "\" & Session("FileName")
saveFile = savedDirVar & "\" & Session("FileName")
response.write copyFile & "----" & saveFile & "<br>"
Set fs=Server.CreateObject("Sc ripting.Fi leSystemOb ject")
Set f=fs.GetFile(copyFile)
f.Copy saveFile,true
f.Delete
set f=nothing
set fs=nothing
End if
next
else
SaveFiles = "The file name specified in the upload form does not correspond to a valid file in the system."
end if
end function
SaveFiles()
response.redirect ("statlink_add.asp")
%>
<%@ 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
Upload.Save(uploadsDirVar)
ks = Upload.UploadedFiles.keys
if (UBound(ks) <> -1) then
for each fileKey in Upload.UploadedFiles.keys
Session("filename") = Upload.UploadedFiles(fileK
If LEN(Session("Filename")) > 1 Then
copyFile = uploadsDirVar & "\" & Session("FileName")
saveFile = savedDirVar & "\" & Session("FileName")
response.write copyFile & "----" & saveFile & "<br>"
Set fs=Server.CreateObject("Sc
Set f=fs.GetFile(copyFile)
f.Copy saveFile,true
f.Delete
set f=nothing
set fs=nothing
End if
next
else
SaveFiles = "The file name specified in the upload form does not correspond to a valid file in the system."
end if
end function
SaveFiles()
response.redirect ("statlink_add.asp")
%>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.