Per fare un upload sul mio sito ho preso questo script
codice:
<%
Dim strSitePath
Dim strDBName
Dim strDBPath
dim strConn
dim objConn
dim objRs
dim strSql
dim NroFoto
dim StrNewFolder
dim objfso
StrNewFolder= Server.MapPath("/public/foto/" & Session("Pmod_Codice_ins") & "_" & SEssion("Prgannuncio"))
strSitePath=""
strDBName="/annunci"
strDBPath="/mdb-database"
Set objConn=Server.CreateObject("ADODB.Connection")
strConn="driver={Microsoft Access Driver (*.mdb)}; "
strConn=strConn & " DBQ=" & Server.MapPath(strSitePath & strDBPath & strDBName & ".mdb")
objConn.Open strConn
Set objRs = Server.CreateObject("ADODB.Recordset")
strSql="SELECT * FROM Dba_annunci WHERE Codins=" & Session("Pmod_Codice_ins") & " And Prg=" & SEssion("Prgannuncio")
objRs.Open strSql , objConn,3,3
NroFoto = 0
Inse= Session("Pmod_Codice_ins")
if not objRs.EOF then
Response.Expires=0
Response.Buffer = TRUE
Response.Clear
byteCount = Request.TotalBytes
RequestBin = Request.BinaryRead(byteCount)
Dim UploadRequest
Set UploadRequest = CreateObject("Scripting.Dictionary")
BuildUploadRequest RequestBin
contentType = UploadRequest.Item("blob").Item("ContentType")
filepathname = UploadRequest.Item("blob").Item("FileName")
filename = Right(filepathname,Len(filepathname)-InstrRev(filepathname,"\"))
value = UploadRequest.Item("blob").Item("Value")
'Create FileSytemObject Component
Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject")
'Create and Write to a File
pathEnd = Len(Server.mappath(Request.ServerVariables("PATH_INFO")))-14
Set objFso = Server.createObject("Scripting.FileSystemObject")
If objFso.FolderExists ("StrNewFolder") Then
objFso.createFolder(strNewFolder)
end if
Set Myfile = ScriptObject.CreateTextFile(Left(Server.mappath(Request.ServerVariables("PATH_INFO")),pathEnd) & "\public\foto\" & Session("Pmod_Codice_ins") & "_" & SEssion("Prgannuncio") & "_" & filename)
For i = 1 to LenB(value)
MyFile.Write chr(AscB(MidB(value,i,1)))
Next
NroFoto= objrs("Numero_foto") +1
objrs("Numero_foto") = NroFoto
objrs.update
objRs.Close
set objRs = nothing
objConn.Close
set objConn = nothing
MyFile.Close
end if
%>
<head>
<title></title>
</head>
<body bgcolor="#FFCC00">
<p align="center"><font face="Verdana" size="2">
File "<%=filename%>" ricevuto con successo</font>
<p align="center"><font face="Verdana" size="2">home</font></p>
al quale ho aggiunto le parti in grassetto. Perchè io vorrei creare una cartelle e fare l'upload direttamente in quella. Solo che non so come si fa. Avevo provato
codice:
' Set MyFile = ScriptObject.CreateTextFile("StrNewFolder" & Session("Pmod_Codice_ins") & "_" & SEssion("Prgannuncio") & "_" & filename)
ma mi dice "Permission Denied"
:master: