Ja det kan säkert vara så.
Personligen så har jag aldrig mellanslag i webkatalognamn.
Brukar köra underscore i stället.
Frågan#1
Har som sagt ett problem med FSO och mappar. Har ett uppladdningsverktyg som via FSO listar ett antal mappar där bilden kan sparas
<FORM METHOD="POST" ACTION="pic2.asp" ENCTYPE="multipart/form-data">
<select name="map">
<option value="">Välj Katalog</option>
<option>---------------</option>
<%
set fso = server.createobject("scripting.filesystemobject")
set folder =fso.getfolder(Server.Mappath("../bild"))
for each fo in folder.subfolders
response.write "<option value="& fo.name &">"& fo.name &"</option>"
next %>
</select> <br>
<INPUT TYPE="FILE" NAME="FILE1" SIZE="50"><BR>
<INPUT TYPE="SUBMIT" VALUE="Upload">
</FORM>
Sidan pic2.asp tar emot formuläret och spar en thumb, en bild på 350px. och originalet.
Problem: Bilderna sparas i fel mapp. Är mellanslag ett problem? Vill spara i mappen 'Villa Premiär' men bilden lägger sig i mappen 'Villa'
<%
' Variables
' *********
Dim mySmartUpload
Dim file
Dim intCount
Dim mappa
intCount=0
' Object creation
' ***************
Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
' Upload
' ******
mySmartUpload.Upload
' Select each file
' ****************
For each file In mySmartUpload.Files
' Only if the file exist
' **********************
If not file.IsMissing Then
' Save the files with his original names in a virtual path of the web server
' **************************************************************************
'file.SaveAs("/aspSmartUpload/Upload/" & file.FileName)
file.SaveAs(Server.MapPath(mySmartUpload.Form("map")& "/" & file.FileName))
' sample with a physical path
' file.SaveAs("c:\temp\" & file.FileName)
mappa = file.FileName
' Display the properties of the current file
' ******************************************
Response.Write("Name = " & file.Name & "<BR>")
Response.Write("Size = " & file.Size & "<BR>")
Response.Write("FileName = " & file.FileName & "<BR>")
Response.Write("FileExt = " & file.FileExt & "<BR>")
Response.Write("FilePathName = " & file.FilePathName & "<BR>")
Response.Write("ContentType = " & file.ContentType & "<BR>")
Response.Write("ContentDisp = " & file.ContentDisp & "<BR>")
Response.Write("TypeMIME = " & file.TypeMIME & "<BR>")
Response.Write("SubTypeMIME = " & file.SubTypeMIME & "<BR>")
intCount = intCount + 1
End If
Next
' Display the number of files which could be uploaded
' ***************************************************
Response.Write("<BR>" & mySmartUpload.Files.Count & " files could be uploaded.<BR>")
' Display the number of files uploaded
' ************************************
Response.Write(intCount & " file(s) uploaded.<BR>")
Set Jpeg = Server.CreateObject("Persits.Jpeg")
Path = Server.MapPath(mySmartUpload.Form("map")) & "/" & mappa
Jpeg.Open Path
' New width
L = 100
' Resize, preserve aspect ratio
Jpeg.Width = L
Jpeg.Height = Jpeg.OriginalHeight * L / Jpeg.OriginalWidth
Jpeg.Save Server.MapPath(mySmartUpload.Form("map")) & "/th_" & mappa
Path = Server.MapPath(mySmartUpload.Form("map")) & "/" & mappa
Jpeg.Open Path
' New width
L = 350
' Resize, preserve aspect ratio
Jpeg.Width = L
Jpeg.Height = Jpeg.OriginalHeight * L / Jpeg.OriginalWidth
Jpeg.Save Server.MapPath(mySmartUpload.Form("map")) & "/big_" & mappa
%>
