Ik heb een file uploader "gemaakt"
Simpel form post naar onderstaande code:
Hij zegt alleen:
permision denied. Meestal betekend dit dat er niet genoeg rechten op de betreffende map.
Maar die rechten staan in mijn geval wel goed, omdat een ander scriptje wel kan uploaden in die map.
De regel waar de fout in staat is:
Ik heb dit script niet zelf gemaakt, dus ik vraag me ook af waarom hij een textfile gaat maken. Maar weglaten gaat ook niet. Het lijkt mij dat hier een ander commando moet staan, omdat dit script bestemd is voor images en niet voor text.
Simpel form post naar onderstaande code:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
| <html><body>
<%
' This code is needed to "initialize" the
' retrieved data
Dim q
q = Chr(34)
' All data
Dim aAllDataB, aAllData, x, aHdr
aAllDataB = Request.BinaryRead(Request.TotalBytes)
' It comes in as unicode, so convert it to ascii
For x = 1 To LenB(aAllDataB)
aAllData = aAllData & Chr(AscB(MidB( _
aAllDataB, x, 1)))
Next
' The "header" is a unique string generated by the
' system to indicate the beginning
' and end of file data
aHdr = Left(aAllData, Instr(aAllData,vbCrLf)+1)
%>
<%
' Here's where your code goes.
' In this example, "file1" and "file2" are the
' field names specified within the form of the
' upload submission page.
Response.Write "file1: Filename = " & _
GetFilename("file1") & "<br>"
Response.Write ("file1") _
& "<br><br>"
' Writing out the file data like this only looks
' OK when the uploaded file is some kind of text
' — images and things like that probably just need
' to be saved or otherwise acted upon.
'Response.Write Replace(aAllData,vbCrLf,"<br>")
Dim aFilename
' aFilename equates to the original filename,
' except saved in the root path of the server.
' The root path must have Change rights for the
' default Internet user.
aFilename = ("d:/pathnaarmapmetuploadrechten")
GetFileName("file1")
response.write afilename
Call SaveFile("file1", aFilename)
%>
</body></html>
<%
' These are functions used to retrieve the data
Function GetFileName(aField)
Dim x2, i
x = Instr(aAllData, aHdr & _
"Content-Disposition: form-data; name=" & _
q & aField & q)
x = Instr(x, aAllData, "filename=" & q)
x2 = Instr(x, aAllData, vbCrLf)
For i = x2 To x Step -1
If Mid(aAllData,i,1) = "\" Then
x = i - 9
Exit For
End If
Next
GetFileName = Mid(aAllData, x+10, x2-(x+11))
End Function
Function GetFileData(aField)
Dim x2
x = Instr(aAllData, aHdr & _
"Content-Disposition: form-data; name=" & _
q & aField & q)
x = Instr(x, aAllData, vbCrLf)
x = Instr(x+1, aAllData, vbCrLf)
x = Instr(x+1, aAllData, vbCrLf) + 2
x2 = Instr(x, aAllData, Left(aHdr,Len(aHdr)-2))
GetFileData = Mid(aAllData, x+2, x2-x-4)
End Function
Function SaveFile(aField, aFilename)
Dim FSO, TS
Set FSO = _
server.CreateObject( _
"Scripting.FileSystemObject")
Set TS = FSO.CreateTextFile(aFilename, True, _
False)
TS.Write GetFileData(aField)
TS.Close
Set TS = Nothing
Set FSO = Nothing
End Function
%> |
Hij zegt alleen:
permision denied. Meestal betekend dit dat er niet genoeg rechten op de betreffende map.
Maar die rechten staan in mijn geval wel goed, omdat een ander scriptje wel kan uploaden in die map.
De regel waar de fout in staat is:
code:
1
2
| Set TS = FSO.CreateTextFile(aFilename, True, _
False) |
Ik heb dit script niet zelf gemaakt, dus ik vraag me ook af waarom hij een textfile gaat maken. Maar weglaten gaat ook niet. Het lijkt mij dat hier een ander commando moet staan, omdat dit script bestemd is voor images en niet voor text.