Greetings,
This is my first post here but I've been reading here a while and have developed a bit of a problem I thought I'd seek some advice on.
As the subject suggests, I'm building a page with ASP and using VBScript as my language. I'm relatively new to programming in general so forgive me if I'm way off base here somewhere.
What I'm doing is reading file names from a directory on my server and storing them as one long string in a variable. The filenames are actually a relative path like "/folder/filename.jpg." These are being brought in with the FileSystemObjec t and loaded in to the variable with a loop.
Then, I try to write the contents out...
Now, in researching this up to this point (even on these very forums), I learned that when you split a variable like I've done to fileList, newList becomes an array of everything separated by a "," in fileList.
But, when I try to write the values saved in the array I get an error "Type mismatch: '/testfolder/testimg.jpg'"
I've tried quite a bit but obviously haven't been able to get it working. What am I missing here?
Not that I think it matters for this particular issue, but I'm running IIS on XP Pro.
Thanks in advance!
Edit --> response.write( fileList) prints all the relative paths just fine just like the code looks like it should.
/folder/testimage1.jpg,/folder/testimage2.jpg,/folder/testimage3.jpg,/folder/testimage4.jpg and on and on.
This is my first post here but I've been reading here a while and have developed a bit of a problem I thought I'd seek some advice on.
As the subject suggests, I'm building a page with ASP and using VBScript as my language. I'm relatively new to programming in general so forgive me if I'm way off base here somewhere.
What I'm doing is reading file names from a directory on my server and storing them as one long string in a variable. The filenames are actually a relative path like "/folder/filename.jpg." These are being brought in with the FileSystemObjec t and loaded in to the variable with a loop.
Code:
for each item in folder.Files url = MapURL(item.path) ' store the file names if fileList = NULL Then fileList = url & "," else fileList = fileList & url & "," end if next
Code:
response.write(fileList)
response.write("<br><br>")
newList = split(fileList,",")
for each i in newList
response.write(newList(i) & "<br>") '<--- this line throws the error
next
But, when I try to write the values saved in the array I get an error "Type mismatch: '/testfolder/testimg.jpg'"
I've tried quite a bit but obviously haven't been able to get it working. What am I missing here?
Not that I think it matters for this particular issue, but I'm running IIS on XP Pro.
Thanks in advance!
Edit --> response.write( fileList) prints all the relative paths just fine just like the code looks like it should.
/folder/testimage1.jpg,/folder/testimage2.jpg,/folder/testimage3.jpg,/folder/testimage4.jpg and on and on.
Comment