Hey Jag löste det...aspUpload - Upload.Form - Sökvägsprb
Har ett script ( se nedan ) som laddar upp bilder till servern. ( loopia ).
Det funkar rätt bra, förrutom en grejj.
Sökvägen.
Det är tydligen så att man kan inte hämta data från Upload.Form före man har kört upload.save.
Detta ställer till ett prb efterssom jag har en sökväg i upload.form som jag måsta komma åt innan jag sparar filen.
Känns lite grann som hönan och ägget.
Hur kan man lösa det? Nån som vet?
FORMULÄRET
__________________________________
<%
Response.Write "<FORM method=post name=uploadPic ENCTYPE=multipart/form-data action=XXX>"
Response.Write "<b>Välj mapp att ladda upp till</b><br>"
Response.Write "<SELECT name='targetFolder' style='width=100%;'>"
Set mappLista = Server.CreateObject("Scripting.FileSystemObject")
Set mainFolder = mappLista.GetFolder(Server.MapPath("images/galleri"))
Set myList = mainFolder.subFolders
For Each Folder in myList
Response.Write "<option value='" & Folder.Name & "'>" & Folder.Name & "</option>"
Next
Set mappLista = Nothing
Set mainFolder = Nothing
Set myList = Nothing
Response.Write "</SELECT><br><br>"
Response.Write "<b>Bläddra fram bilden/bilderna</b><br>"
Response.Write "<input type=file size=70 name=file01><br>"
Response.Write "<input type=file size=70 name=file02><br>"
Response.Write "<input type=file size=70 name=file03><br>"
Response.Write "<input type=file size=70 name=file04><br>"
Response.Write "<input type=file size=70 name=file05><br>"
Response.Write "<div align=right><input type=submit name=submit value='Ladda upp bilden'></div>"
Response.Write "</FORM><br>"
%>
SCRIPT
______________________
<%
Set Upload = Server.CreateObject("Persits.Upload.1")
Upload.OverwriteFiles = False
On Error Resume Next
Upload.SetMaxSize 1048576
Count = Upload.Save(Server.mapPath("images/galleri/" & Upload.Form("targetFolder")))
%>
Sv: aspUpload - Upload.Form - Sökvägsprb
<%
Set Upload = Server.CreateObject("Persits.Upload.1")
Upload.OverwriteFiles = False
On Error Resume Next
Upload.SetMaxSize 1048576
Upload.Save
subdir = Upload.Form("targetFolder")
Path = Server.mapPath("images/galleri/" & subdir)
Upload.CreateDirectory Path, True
For Each File in Upload.Files
File.SaveAs Path & "/" & File.FileName
Next
Session("message") = "Bilderna är uppladdade"
Response.Redirect "default.asp?p=galleri"
%>