A
Alex
I am having issues with a script to upload files from a client to a
webserver. The problem is not with the actual upload but with where it
uploads. The whole process is supposed to create a folder (it does)
then upload the file to that folder and this is where the problem comes
in. The file is written to the parent directory, not the directory
that was created for this user. Following is the code.
<%
strFTProotFolder = "c:\web\upload\share" 'file is saved here
Set DirectoryObject = Server.CreateObject("Scripting.FileSystemObject")
Set Upload = Server.CreateObject("Persits.Upload")
If Not DirectoryObject.FolderExists(strFTProotFolder & "\" &
upload.form("RequestID") Then
response.write("Error: Folder Does Not Exist!")
Else
strUploadTo = strFTProotFolder & "\" & upload.form("RequestID") 'file
is supposed to be saved here
Count = Upload.Save(strUploadTo)
Set file = Upload.Files("file1")
Response.Write(Count & " file uploaded.<br>")
Response.Write(upload.form("RequestID") & "<br>")
For Each File in Upload.Files
Response.Write(File.OriginalFileName & " (" & File.Size &"
bytes)<br>")
Next
End If
%>
I think the problem has to do with the 'RequestID' variable. It is
empty until after this line " Count = Upload.Save(strUploadTo) ". I
don't understand why it isn't populated until then. I had it print the
value of said variable every other line to see what it's value was
through the process.
webserver. The problem is not with the actual upload but with where it
uploads. The whole process is supposed to create a folder (it does)
then upload the file to that folder and this is where the problem comes
in. The file is written to the parent directory, not the directory
that was created for this user. Following is the code.
<%
strFTProotFolder = "c:\web\upload\share" 'file is saved here
Set DirectoryObject = Server.CreateObject("Scripting.FileSystemObject")
Set Upload = Server.CreateObject("Persits.Upload")
If Not DirectoryObject.FolderExists(strFTProotFolder & "\" &
upload.form("RequestID") Then
response.write("Error: Folder Does Not Exist!")
Else
strUploadTo = strFTProotFolder & "\" & upload.form("RequestID") 'file
is supposed to be saved here
Count = Upload.Save(strUploadTo)
Set file = Upload.Files("file1")
Response.Write(Count & " file uploaded.<br>")
Response.Write(upload.form("RequestID") & "<br>")
For Each File in Upload.Files
Response.Write(File.OriginalFileName & " (" & File.Size &"
bytes)<br>")
Next
End If
%>
I think the problem has to do with the 'RequestID' variable. It is
empty until after this line " Count = Upload.Save(strUploadTo) ". I
don't understand why it isn't populated until then. I had it print the
value of said variable every other line to see what it's value was
through the process.