Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File existing checking

Status
Not open for further replies.

discusmania

IS-IT--Management
Oct 24, 2000
158
AP
I've write this code. I know there's something wrong.... can anyone correct me?

Thanks so much
New in ASP...

Set ScriptObject = server.CreateObject("Scripting.FileSystemObject")
'check the file existing--Nor(2/2/01)
if ScriptObject.FileExist(Server.mappath(Request.ServerVariables("PATH_INFO"))) then
response.write"file exist"
else
'Create and Write to a File
pathEnd = Len(Server.mappath(Request.ServerVariables("PATH_INFO")))-12
'12 is the length of chars used to spell s a v e f i l e . a s p

Set MyFile=ScriptObject.CreateTextFile(Left(Server.mappath(Request.ServerVariables("PATH_INFO")),pathEnd)&filename)

For i = 1 to LenB(value)
MyFile.Write chr(AscB(MidB(value,i,1)))
Next
session("urlupload")=" & filename
'response.write session("urlupload")
MyFile.Close
'response.redirect(" response.write"upload complete"
end if
 
Looking at it quickly, the redirect will not work because it needs to be above the <html> tag. I am assuming because I see response.write that this is in the body.
What kind of problems are you getting?

Wushutwist
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top