Upload text file

aerohost

Member
Licensed User
Hi, I'm trying to upload a simple text file using the http method to a folder on my server which has 'write' permissions set. The following code does not produce an error, but the file does not arrive on the server. Does Anyone have any ideas?

Tks, Adrian

Sub Globals

Dim dataReceived
Dim orderText
Dim orderString
Dim orderLength
Dim orderNumber
Dim orderNumberLine
Dim endIndex
Dim orderFile
Dim Buffer(4096) As byte
End Sub

Sub App_Start

'create file
FileOpen (c1,"test.txt",cWrite,,cASCII)
FileWrite (c1,"test")
FileClose (c1)

'upload file
Response.New1
Request.New1("http://[server domain]/[server folder]/test.txt")
Request.Method = "PUT"
Writer.New1(Request.GetStream,true)

FileOpen(c1,"test.txt",cRandom)
Reader.New1(c1,true) 'Reads the local file.
count = Reader.ReadBytes(buffer(),4096)

Do While count > 0
Writer.WriteBytes2(buffer(),0,count)
count = Reader.ReadBytes(buffer(),4096)
Loop

FileClose (c1)
Request.GetResponse

'UploadFile(orderFile, URL)

End Sub
 
Top