6 Replies - 6143 Views - Last Post: 07 June 2011 - 12:58 PM Rate Topic: -----

#1 hemo   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 70
  • Joined: 02-January 07

Down Loading Files by Database Reference

Posted 02 June 2011 - 12:47 PM

I am using asp:FileUpload control to upload files to a folder in the root of the website. I can retrieve the uploaded file manually with
<a runat="server" href="uploads\myfile.pdf">My File</a>
. I want to populate the MySql database, within the file upload function with data to enable it to be down loaded on select page(s) to recall the uploaded file.
I can retrieve the uploaded file name
FileUpload1.PostedFile.FileName
but my problem is including it in a workable string to fill the DB with an active link for future recall

Any assistance will be appreciated.

Is This A Good Question/Topic? 0
  • +

Replies To: Down Loading Files by Database Reference

#2 Nakor   User is offline

  • Professional Lurker
  • member icon

Reputation: 448
  • View blog
  • Posts: 1,504
  • Joined: 28-April 09

Re: Down Loading Files by Database Reference

Posted 02 June 2011 - 07:17 PM

what's the string look like that you're putting into the database now?
Was This Post Helpful? 0
  • +
  • -

#3 hemo   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 70
  • Joined: 02-January 07

Re: Down Loading Files by Database Reference

Posted 04 June 2011 - 10:05 AM

I have tried numerous string
"upload_folder\" & fileUpload.filename
plus including the file name into
the manual link above.
Was This Post Helpful? 0
  • +
  • -

#4 Nakor   User is offline

  • Professional Lurker
  • member icon

Reputation: 448
  • View blog
  • Posts: 1,504
  • Joined: 28-April 09

Re: Down Loading Files by Database Reference

Posted 05 June 2011 - 12:06 PM

That looks like it should be right if the anchor tag you posted in the first post works. Can you provide the code where you're pulling it from the database and putting it into a control?
Was This Post Helpful? 0
  • +
  • -

#5 hemo   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 70
  • Joined: 02-January 07

Re: Down Loading Files by Database Reference

Posted 06 June 2011 - 04:41 AM

I have populated a field in my database with (\uploads\myfile.pdf).

I now need to recall the data to construct an active link. I don’t have a problem downloading the entry,
strSQL = "SELECT * FROM uploadfile"
 myDataAdapter = New MySqlDataAdapter(strSQL, myConnection)

but I not sure how to use the downloaded data to display it as a live link on a selected page.
Was This Post Helpful? 0
  • +
  • -

#6 Nakor   User is offline

  • Professional Lurker
  • member icon

Reputation: 448
  • View blog
  • Posts: 1,504
  • Joined: 28-April 09

Re: Down Loading Files by Database Reference

Posted 07 June 2011 - 04:58 AM

ok, instead of using a standard anchor tag ( <a href=""></a> ) use a hyperlink control.

<asp:HyperLink ID="HyperLink1" runat="server" />



Then in your code behind you can set the values of the HyperLink control

    HyperLink1.NavigateUrl = (the link from the database);
    HyperLink1.Text = "Open File"; // or whatever


This post has been edited by Nakor: 07 June 2011 - 04:58 AM

Was This Post Helpful? 0
  • +
  • -

#7 hemo   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 70
  • Joined: 02-January 07

Re: Down Loading Files by Database Reference

Posted 07 June 2011 - 12:58 PM

Thank you for the reply and advice re: HyperLink which works ok if manually coded with the download data. As previous refer to I am downloading the reference from the DB to Variable ‘link’
 link=MyDataSet.Tables(0).Rows(0) (“uploadedfiles”) 
I have tried to include the variable into
 HyperLink1.NavigateUrl = “link” 
without success, can you advise.

My intention is to download a list of DB references to the uploaded files to say a DataList control so that any one may be selected to download a selected file.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1