Forums
This topic is locked
Uploading and displaying documents in asp page
Posted 10 Oct 2001 19:22:20
1
has voted
10 Oct 2001 19:22:20 Zain Magsi posted:
I would like to display uploaded documents as icons (Word, excel, html,ppt etc) in my asp application. I also want it to accept multiple documents for each record and also display it with the appropriate icon if possible. How can I achieve this?
Zain
Zain Magsi
Replies
Replied 11 Oct 2001 01:12:18
11 Oct 2001 01:12:18 Jack Neary replied:
Hmmm. I've been thinking along this line as well. I have the filenames of uplaoded images stored in an Access Table assocaited with a particular record, so it shouldn't be hard to Right() the value, tear off the extension, check it against a target array populated with a list of "know" extensions.
Here is my member function I was thinking of using to identify the position of the hit in the target array:
Function MemberPos(DataItem, DataArray)
For i = Lbound(DataArray) To Ubound(DataArray)
If DataItem = DataArray(i) Then
MemberPos = i
Exit Function
End If
Next
MemberPos = -1
End Function
If we score a hit, then use the target position to build the image link by using a corisponging array of "link immages".
So:
We start with our arrays:
<font color=green>
targetarray = array("doc", "xls", "pdf"
immagearray = array("wordlink.gif", "excelink.gif","acrobat.gif"
immageALTTag = array("MS-Word Document", "MS Excel Document", "Adobe Acrobat Document"
</font id=green>
You get the idea. If I had more time I would just post the whole solution (and I will, once I write it. <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>
Good Luck. Hope this helped.
Here is my member function I was thinking of using to identify the position of the hit in the target array:
Function MemberPos(DataItem, DataArray)
For i = Lbound(DataArray) To Ubound(DataArray)
If DataItem = DataArray(i) Then
MemberPos = i
Exit Function
End If
Next
MemberPos = -1
End Function
If we score a hit, then use the target position to build the image link by using a corisponging array of "link immages".
So:
We start with our arrays:
<font color=green>
targetarray = array("doc", "xls", "pdf"
immagearray = array("wordlink.gif", "excelink.gif","acrobat.gif"
immageALTTag = array("MS-Word Document", "MS Excel Document", "Adobe Acrobat Document"
</font id=green>
You get the idea. If I had more time I would just post the whole solution (and I will, once I write it. <img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>
Good Luck. Hope this helped.