Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pulling a file from a folder and displaying its content

Status
Not open for further replies.

siena

Technical User
Joined
Jan 30, 2003
Messages
262
Location
US
We currently have a php code that retrieves records from the database and displays them to the screen.

This works fine.
Recently, we have been asked to pull up a file sitting on a directory and display its content to the screen.
For instance, let's say for a second that we have 4 fields

ID fName Lname Title More
1 John Doe Mr. Link

and a header with links to files on file folder.
What we would like to do is once the records are dispalyed, the user will then click on the Link under the header "More" header.
Once this link is clicked, then a flag (another field on our db called approved?) is activated.
If approvedFlag is yes, the link will open a file from folder A.
If the approvedFlag is no, the link will open a file stored on folder B on our directory.
My question is, being that I am new to php, can someone tell me if it is possible to pull a file from a folder and display its content. The file is likely to be an excel file.
Sorry for my rambling and hope that I made some sense.
Thanks in advance
 
Yes, very possible. Look into the fopen and file functions depending on your needs.

If it's an excel file you're going to need to read up on COM components, or export the file to something like a CSV file so you can parse the plain text.
 
ok,
thanks for your response.
I will look into these options.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top