Current location: Hot Scripts Forums » Programming Languages » ASP » How to open a file??


How to open a file??

Reply
  #1 (permalink)  
Old 06-13-03, 02:30 AM
bonnie bonnie is offline
Newbie Coder
 
Join Date: Jun 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation How to open a file??

I'm using an Access Database, and there is a table for me to store the files. Of course the data type is "OLE Objects". But how can the page open this file after searching. Say for example, I want to search the file of 23 Jan,2003, after finished the searching, the file is opened immediately. What can I do?
Reply With Quote
  #2 (permalink)  
Old 06-13-03, 04:03 AM
Tesco Tesco is offline
ASP Guru
 
Join Date: Jun 2003
Location: UK
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
I 'm sorry, I don't understand what your trying to do. A little more explanation please?
Reply With Quote
  #3 (permalink)  
Old 06-13-03, 04:24 AM
bonnie bonnie is offline
Newbie Coder
 
Join Date: Jun 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
It means that there is a database to store all the files. It will base on the date to search the related file. After the file is found, the file will be open in the browser(no need to click any button).
Reply With Quote
  #4 (permalink)  
Old 06-13-03, 04:31 AM
Tesco Tesco is offline
ASP Guru
 
Join Date: Jun 2003
Location: UK
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Yes, but what kind of file is it? Just a web page?

I prosume you have a search script already in place? If so, add this to the end of it:

Response.Redirect("" & rsName.Fields.Item("ColumnName") & "")

Of course, edit it to suit your needs. You'll need to change the bold parts for it to work. But, be careful, make sure you don't close the search recordset before using this code, if you do - it won't work.
Reply With Quote
  #5 (permalink)  
Old 06-13-03, 04:44 AM
bonnie bonnie is offline
Newbie Coder
 
Join Date: Jun 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks a lot!
Some PDF and Excel files.
But is there another way to do it?
Reply With Quote
  #6 (permalink)  
Old 06-13-03, 04:57 AM
Tesco Tesco is offline
ASP Guru
 
Join Date: Jun 2003
Location: UK
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
Ah, well, for those you need do it differently. IIRC you need open a data stream - but I have no experience with that You can try Google, but Shane will probably know what you need to do.
Reply With Quote
  #7 (permalink)  
Old 06-13-03, 05:03 AM
bonnie bonnie is offline
Newbie Coder
 
Join Date: Jun 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Smile

Anyway, thanks a lot!!
Reply With Quote
  #8 (permalink)  
Old 06-13-03, 07:26 PM
Shane Shane is offline
Coding Addict
 
Join Date: Jun 2003
Location: Maryland, US
Posts: 268
Thanks: 0
Thanked 0 Times in 0 Posts
If I understand you correctly, you are trying to load a binary file (XLS, PDF, DOC..etc) from an Access database and display it.

You really shouldn't store these types of files in Access. Sure, you can do it. It's possible, but it's not very reliable at all.

What I typically do is this:

- Setup your files table like this:

Code:
| ID | file_name |
---------------------
- When a user uploads a file, store the filename in the database and place the actual document in a folder that all of the documents will be located in.

- Now, when the user goes to the "Load Document" ASP page, just do a:

Code:
Response.Redirect("/documents/" & RS("file_name"))

Note: Replace the RS code with your actual Recordset object.
__________________
Shane Bauer
Microsoft Certified Professional (MCP) - ASP.NET
ASP/ASP.net, C#, VB/VB.NET, PHP, Perl, SQL
Reply With Quote
  #9 (permalink)  
Old 06-14-03, 07:38 AM
bonnie bonnie is offline
Newbie Coder
 
Join Date: Jun 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
I understand what you are doing. I cannot use "ID", since there is 5 years files in the database. We need to base on the date to search the specific file.
Reply With Quote
  #10 (permalink)  
Old 06-14-03, 09:38 AM
Shane Shane is offline
Coding Addict
 
Join Date: Jun 2003
Location: Maryland, US
Posts: 268
Thanks: 0
Thanked 0 Times in 0 Posts
Well, how is your table setup?
__________________
Shane Bauer
Microsoft Certified Professional (MCP) - ASP.NET
ASP/ASP.net, C#, VB/VB.NET, PHP, Perl, SQL
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
New Web Host, New Problem! justchat PHP 2 09-29-03 02:39 PM
Writes to a text file gamextremer2003 JavaScript 4 09-11-03 09:43 AM
Upload file type and size limiter! Arctic ASP 1 08-02-03 07:06 PM
how to get info from TXT file between %%customTags%% as vars?? paulj000 PHP 2 07-26-03 05:00 AM
ASP Renaming a file (with some filename parsing) camt ASP 2 06-30-03 09:53 PM


All times are GMT -5. The time now is 03:48 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.