I'm having trouble creating a function to upload
i have the file name, extension, directory, but does not save, missing some command ?
code below
Server.ScriptTimeout = 5400
EstensoesProibidas=",exe,asp,php,sql,bat,pif,ocx,dll,aspx,shtml,"
ExtensoesPermitidas="," & ExtensoesPermitidas & ","
strArquivo = request.form("GROB")
strPath = "C:\Wellington"
%> <form></form><%
response.write "directory: " & strPath
'Path of the original file
filepathname = strArquivo
%> <form></form><%
response.write "File Location: " & strArquivo
'Gets the extension
For i = Len(filepathname) To 1 Step -1
If Mid(filepathname, i, 1) = "." Then Exit For
Next
extension= Right(filepathname, Len(filepathname) - i)
%> <form></form><%
response.write "extension: " & extension
if ExtensoesPermitidas=",*," then
pode=(InStr(extensao,EstensoesProibidas)=0)
else
pode=(InStr(extensao,EstensoesPermitidas)>0)
end if
if pode then
'Create FileSytemObject Component
Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject")
if not ScriptObject.FolderExists(strPath) then ScriptObject.CreateFolder(strPath)
filename = ""
if filename="" then
For i = Len(filepathname) To 1 Step -1
If Mid(filepathname, i, 1) = "\" Then Exit For
Next
filename = Right(filepathname, Len(filepathname) - i)
end if
%> <form></form><%
response.write "file : " & filename
'Create and Write to a File (WARNING: Overwrites existing!)
pathfilename = strPath & "\" & filename
%> <form></form><%
response.write "file : " & pathfilename
Set MyFile = ScriptObject.CreateTextFile(pathfilename,true)
For i = 1 to LenB(value)
MyFile.Write chr(AscB(MidB(value,i,1)))
Next
MyFile.Close
end if