Solved

PHP web form to upload file and then provide link to download file

Posted on 2007-03-19
3
223 Views
Last Modified: 2008-02-01
We need to use a PHP web form to upload a file (word or excel), then display a link to the file and make it available for others to download.  (We already have a login set up to enable access to this page.)

How is this file displayed for others to see and download?  Can we identify the file using the file name?  Can I list a last modified date for the file?  Can a group of users be notified by email when a new file is uploaded?

I'm just not sure how/where to get started on this.  Anyone know of a tutorial /script?  Or could you help me get startd from scratch?

Many thanks for your time and help .....

April

0
Comment
Question by:aprillougheed
  • 2
3 Comments
 
LVL 24

Accepted Solution

by:
glcummins earned 500 total points
ID: 18748606
You can find a good file upload tutorial here:

http://www.tizag.com/phpT/fileupload.php

To make the filel available for download, just save the name of the file in a database. Then you can use something like this:

$fileLocation = "http://www.mysite.com/files/";

$query = "SELECT filename FROM files";
$result = mysql_query($query);

while ($row = mysql_fetch_object($result))
{
   ?><a href="<?php echo $fileLocation . $row->filename; ?>"><?php echo $row->filename; ?><br /><?php
}

This will display a list of files, and clicking a file will cause it to download.

The answers to your other questions are Yes:

 Can we identify the file using the file name?
 Can I list a last modified date for the file?
 Can a group of users be notified by email when a new file is uploaded?

However, they may be topics for a different question, and should probably be answered after you build your basic script.
0
 

Author Comment

by:aprillougheed
ID: 18803460
glcummins - I'm so sorry. I forgot this was open.  We ended up using Interakt Kollection. It is working great.  April
0
 
LVL 24

Expert Comment

by:glcummins
ID: 18803474
No problem at all. I'm glad you found something that works well for you!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now