p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 1.0 and 1.1 Basics (http://p2p.wrox.com/forumdisplay.php?f=60)
-   -   What type of field/control for File attachments? (http://p2p.wrox.com/showthread.php?t=17138)

Renu August 19th, 2004 01:01 PM

What type of field/control for File attachments?
I need to have a field on the form where people can attach a link to a pdf file or paste a URL link. What kind of field should be used in the database and on the form. Also, any related links/reading material would be highly appreciated.


happygv August 20th, 2004 09:19 AM

Hi Renu,

Where do these PDFs files exist? Are they going to enter the URL/link to PDF file that exists on the webserver or on the internet?

Whatever, IMO, you can have a textbox where one can enter the URL to the PDF and the same can be stored in the DB as varchar/nvarchar with needed length. If the same required to be shown on the webpage, while displaying you can show that as

<a href="URL_That_Comes_FROM_DB">PDF NAME</a>

Hope I understood it right and that helps.

- Vijay G
Strive for Perfection

Renu August 22nd, 2004 06:10 PM

Hi Vijay-
I found some code on the web for file upload and download.Right now to keep it simple I am not using any database. I am just uploading to the server and downloading from the server. The upload is working fine. However, for file download the dialog window is showing 2 times, I have to click on "Open" 2 times to actually open the pdf file. The "Save" option works fine. This is the only code in the imagebutton's click method. I am using an image button to view the file. Can you guess as to why clicking on open once does not work.

    Private Sub ImageButton1_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
        Dim objFileInfo As System.IO.FileInfo
        Dim strPhysicalPath As String
        strPhysicalPath = Server.MapPath("docbox.pdf")

        objFileInfo = New System.IO.FileInfo(strPhysicalPath)

        Response.ContentType = "application/pdf"
        Response.AppendHeader("Content-Disposition", "attachment; filename" + objFileInfo.FullName)
        Response.AddHeader("Content-Length", objFileInfo.Length.ToString())

    End Sub


All times are GMT -4. The time now is 02:50 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.