Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 19th, 2004, 01:01 PM
Authorized User
 
Join Date: Aug 2004
Posts: 86
Thanks: 0
Thanked 0 Times in 0 Posts
Default What type of field/control for File attachments?

Hi-
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.

Thanks
Renu
 
Old August 20th, 2004, 09:19 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

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.
Cheers!

_________________________
- Vijay G
Strive for Perfection
 
Old August 22nd, 2004, 06:10 PM
Authorized User
 
Join Date: Aug 2004
Posts: 86
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.ClearContent()
        Response.ClearHeaders()
        Response.ContentType = "application/pdf"
        Response.AppendHeader("Content-Disposition", "attachment; filename" + objFileInfo.FullName)
        Response.AddHeader("Content-Length", objFileInfo.Length.ToString())
        Response.WriteFile(objFileInfo.FullName)
        Response.Flush()
        Response.End()

    End Sub

Thanks!






Similar Threads
Thread Thread Starter Forum Replies Last Post
Queries On File Field Html Control in ASP.NET 1.1 daffodils ASP.NET 1.0 and 1.1 Basics 1 October 30th, 2006 11:30 AM
Can I create my own File Field control in ASP.Net vbmazza ASP.NET 1.0 and 1.1 Professional 1 February 22nd, 2006 11:45 AM
Convert "String" type to "Control" type ? kishore_peddi C# 4 January 11th, 2006 01:21 PM
<input type="File"> - Specify File Type and Path gp_mk Classic ASP Basics 2 August 2nd, 2004 03:07 AM
Retrive text from input type field of html file?? bikash Javascript 10 July 30th, 2003 04:50 AM





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