webForumDet fria alternativet

Skapa mapp

ASP

11 svar · 190 visningar · startad av His Divine Shadow

Medlem sedan sep. 20004 079 inlägg
Frågan#1

Jag undrar hur jag kan ändra det här scriptet så det skapar en mapp med samma namn som username "variblen"
Sen ska ju upload pathen ändras till det också så att filen laddas upp i en mapp med användarens namn.

'<%
'  Variables
'  *********
   Dim mySmartUpload
   Dim intCount
        
'  Object creation
'  ***************
   Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")

'  Upload
'  ******
   mySmartUpload.Upload

'  Save the files with their original names in a virtual path of the web server
'  ****************************************************************************
   intCount = mySmartUpload.Save("/Katalog/Images")
   ' sample with a physical path 
   ' intCount = mySmartUpload.Save("c:\temp\")
%>

<%
'Declare all local variables

dim conn
dim rs
dim strID
dim strconn

'set a local variable to my DSN-less connection String
strconn = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=C:\data\WebData\katalog.mdb;"

'Create the Connection object 
set conn = server.createobject("adodb.connection")
conn.open strconn

'Create the recordset object
set rs = server.createobject("adodb.recordset")
'This statement opens the table so we can add a record notice the addnew 
'The 2, 2 is how the table is opened there are many ways it can be opened
rs.open "Kat", conn, 2, 2

'Use the addnew method of the recordset object to add a record
rs.addnew
'Set the table column = to my input text box from my form
rs("Namn") = mySmartUpload.Form("Namn") 
rs("Naradress") = mySmartUpload.Form("Naradress")
rs("Postnr") = mySmartUpload.Form("Postnr") 
rs("Ort") = mySmartUpload.Form("Ort")
rs("Tel") = mySmartUpload.Form("Tel") 
rs("Fax") = mySmartUpload.Form("Fax")
rs("Epost") = mySmartUpload.Form("Epost")
rs("www") = mySmartUpload.Form("www") 
rs("Amnesomrade") = mySmartUpload.Form("Amnesomrade")
rs("Ovrigt_swe") = mySmartUpload.Form("Ovrigt_swe") 
rs("Ovrigt_fin") = mySmartUpload.Form("Ovrigt_fin")
rs("Username") = mySmartUpload.Form("Username")
rs("Password") = mySmartUpload.Form("Password")
rs("Filename") = mySmartUpload.Form("Filename")
rs.update
'I do a movelast here to get the ID that is automatically generated 
'I also set the value to a local variable so I can write out to the database
rs.movelast
strID = rs("ID")

%>

------------------
His Divine Shadow is the most despicable being ever created, short and to the point.

http://forums.planetdivine-shadow.com

Sprit löser inga problem. Men det gör inte mjölk heller.

Medlem sedan dec. 19996 721 inlägg
#2

Du får använda FileSystemObjects metod CreateFolder

Medlem sedan sep. 20004 079 inlägg
#3

ah, lite mera info om hur jag använder det?

------------------
His Divine Shadow is the most despicable being ever created, short and to the point.

http://forums.planetdivine-shadow.com

Sprit löser inga problem. Men det gör inte mjölk heller.

Medlem sedan dec. 19996 522 inlägg
#4

dim mappnamn
mappnamn = request.form("mappnamn")
Set Skapa = Server.CreateObject("Scripting.FileSystemObject")
Set Mapp = Skapa.CreateFolder(Server.MapPath(mappnamn))

------------------
Real mad hiphop flavaz kickin' it right from tha street without no FEAR, Yo !

Medlem sedan sep. 20004 079 inlägg
#5

Funkar inte riktigt får:

Microsoft VBScript runtime error '800a0006'

Overflow

/katalog/swe/adduser.asp, line 11

<%

'  Variables
'  *********
   Dim mySmartUpload
   Dim intCount
        
dim skapamapp
username  = request.form("username")
Set Skapa = Server.CreateObject("Scripting.FileSystemObject")
Set Mapp  = Skapa.CreateFolder(Server.MapPath(katalog/images/skapamapp))

'  Object creation
'  ***************
   Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")

'  Upload
'  ******
   mySmartUpload.Upload

'  Save the files with their original names in a virtual path of the web server
'  ****************************************************************************
   intCount = mySmartUpload.Save("/Katalog/Images/skapamapp")
   ' sample with a physical path 
   ' intCount = mySmartUpload.Save("c:\temp\")
%>

------------------
His Divine Shadow is the most despicable being ever created, short and to the point.

http://forums.planetdivine-shadow.com

Sprit löser inga problem. Men det gör inte mjölk heller.

[Redigerat av His Divine Shadow den 25 sep 2001]

Medlem sedan dec. 19996 522 inlägg
#6

Du har ju inte något i variabeln skapamapp

but ut username mot Skapamapp = request.form("username")

------------------
Real mad hiphop flavaz kickin' it right from tha street without no FEAR, Yo !

[Redigerat av erka den 25 sep 2001]

Medlem sedan sep. 20004 079 inlägg
#7

OK har det såhär nu men fortfarande samma overflow fel.

dim skapamapp
skapamapp  = request.form("username")
Set Skapa = Server.CreateObject("Scripting.FileSystemObject")
Set Mapp  = Skapa.CreateFolder(Server.MapPath(katalog/images/skapamapp))

------------------
His Divine Shadow is the most despicable being ever created, short and to the point.

http://forums.planetdivine-shadow.com

Sprit löser inga problem. Men det gör inte mjölk heller.

Medlem sedan dec. 19996 721 inlägg
#8

"katalog/images/" & skapamapp

Medlem sedan sep. 20004 079 inlägg
#9

Path not found

Set Mapp = Skapa.CreateFolder(Server.MapPath("Katalog/images/" & skapamapp))

Mapparna katalog/images ligger direkt under webrooten.

------------------
His Divine Shadow is the most despicable being ever created, short and to the point.

http://forums.planetdivine-shadow.com

Sprit löser inga problem. Men det gör inte mjölk heller.

Medlem sedan mars 20002 836 inlägg
#10
Set Mapp = Skapa.CreateFolder(Server.MapPath("[b]/[/b]Katalog/images/" & skapamapp))

cya,
PatrikB

------------------
*ordning och reda!, pengar på fredag.*

Medlem sedan sep. 20004 079 inlägg
#11

nu kommer det:
Microsoft VBScript runtime error '800a003a'

File already exists

Samma kodbit.

------------------
His Divine Shadow is the most despicable being ever created, short and to the point.

http://forums.planetdivine-shadow.com

Sprit löser inga problem. Men det gör inte mjölk heller.

Medlem sedan sep. 20004 079 inlägg
#12

OK fixat det själv.

------------------
His Divine Shadow is the most despicable being ever created, short and to the point.

http://forums.planetdivine-shadow.com

Sprit löser inga problem. Men det gör inte mjölk heller.

261 ms totalt · 4 externa anrop · v20260731065814-full.1dc6f849
117 ms — deklarationer (db)
0 ms — hämta statistik (cache)
132 ms — hämta tråd, inlägg och bilagor (db)
126 ms — ändringar (db)