Solved

Can't download .doc, .rtf or .pdf (only image files).

Posted on 2004-09-21
13
276 Views
Last Modified: 2008-03-06
I uplaod files using ASP, then list them and can download if the filename is clicked on.

This only works for .gif and .jpg.

anyone know why?

here's where i list the filenames as links:

[code]
<TABLE id="Table1" cellSpacing="1" cellPadding="1" width="75%" border="1" align="center">
                  <TR>
                        <TD width="25%" align="center"><b><i>Delete</i></b></TD>
                        <TD width="25%" align="center"><b><i>Action</i></b></TD>
                        <TD width="50%" align="center"><b><i>File</i></b></TD>
                  </TR>
                  <%
            while not rs.EOF      
                  query = "<A href=\FoodBev\UploadedFiles\" & rs("RoomID") & "\" & server.URLEncode(rs("filename")) & ">" & rs("filename") & "</a>"
                  response.write ("<tr><td align=""center""><INPUT id=""Checkbox1"" name=""remove"" type=""checkbox""  value=""" &  rs("id") & """></td><td align=""center"">" + rs("description") + "</td><td>" +  query + "</td></tr>")
            rs.MoveNext
            wend
            rs.close

            
            'end if
            
                        %>
            </TABLE>
[/code]
0
Comment
Question by:st10101
  • 6
  • 5
  • 2
13 Comments
 
LVL 10

Expert Comment

by:Jay Toops
ID: 12113514
what is the error generated when you try to DL the doc files?

JAY
0
 

Author Comment

by:st10101
ID: 12113765
"Internet Explorer cannot download posters.doc from webapps.

Internet Explorer was not able to open this internet site. The requested site is either unavailable or cannot be found.  Please try again later."

webapps is the root directory (server).

the path is correct because image files work, and i can see the path in the status bar.
0
 
LVL 10

Accepted Solution

by:
Jay Toops earned 250 total points
ID: 12113805
Use a fully qualified url.

supply http://server/directory

also make sure from a web browser you can reach that folder
IE.. make sure http://server/dir/filename.doc will come up

it could be security is preventing that directory from being accessed

Jay
0
 

Author Comment

by:st10101
ID: 12114570
i used the full path, still same error.

i was able to download posters.doc with firefox when i put in the full path to that document.  but when i use firefox to pull the document using the form, it doesn't work.
0
 
LVL 9

Expert Comment

by:apirnia
ID: 12117337
You should use a ServerMap path.

Lets say your ASP is at the following directory:
wwwroot/site/tools/file.asp

And your files are at the following Directory:
wwwroot/filedirectory


your path in the database that you use as link should look like this.
../filedirectory/883.doc

Couple of notes, filedirectory should be set as a virtual directory unless it is under your main site. I also realized that you used backslashes for your path. They should be forward slash.
0
 
LVL 9

Expert Comment

by:apirnia
ID: 12117364
ALmost works same as the FSO which is another way you can get all files name as testing stage befor you move to DB.

Set folder = fso.GetFolder(Server.MapPath("../../filedirectory/"))
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 10

Expert Comment

by:Jay Toops
ID: 12122273
maybee its because ur using urlencode on the filename and you don't need to?

do you have a link to this page i can see?
JAY
0
 

Author Comment

by:st10101
ID: 12122920
the page is on an intranet, so it is not out on the www.

i just tried to right-click and save a jpg, i got an error saying the file couldn't be written to the cache.  but if i click the link i can see the image.

i changed the slashes to forward slashes, same result.

is it really neccessary to use ServerMap?  i just want the code to work right now, i can clean it up later.  is that what ServerMap is used for? to clean up the code?

for some reason i think it's because it's an https link and not straight http.

i'll look it up..
0
 
LVL 10

Expert Comment

by:Jay Toops
ID: 12122947
try just putting the href's on a standard html page and see what happens
JAY
0
 

Author Comment

by:st10101
ID: 12123002
my problem was a browser setting:

The Do not save encrypted pages to disk check box is selected in Internet Explorer 6.0 SP1.

LINK: http://www.it-faq.pl/mskb/812/935.HTM
0
 
LVL 10

Expert Comment

by:Jay Toops
ID: 12123026
hmm Very interesting ..

Thanks for the points.

Jay
0
 

Author Comment

by:st10101
ID: 12123032
u did try to help me, thanks for the effort.

i guess u were right, it was a security thing!
0
 
LVL 10

Expert Comment

by:Jay Toops
ID: 12123190
LOL...
and we wonder why are users go banans all the time trying to use our stuff.
..

have fun
JAY
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

This article describes some very basic things about SQL Server filegroups.
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now