PHP & mySQL Help.
Posted 28 August 2006 - 01:32 AM
I would like to have an 'file upload' script where only I can upload files.. meaning have a user name and password. I would like the file type to be limited to files with the exstenion ".rep" and once they have been uploaded I would like them displayed in a table on the webpage with the information I uploaded them with, example of form information:
In the table I would like them to be downloadable from clicking on a link under the "Download" row. So to have them displayed there in order from oldest on the bottom and newest on the top would be great. I dont really care about having more than 1 page if it helps me get this done sooner.
So could someone point me in the right direction? I'm killing myself over this
Posted 28 August 2006 - 02:22 AM
Posted 28 August 2006 - 02:26 AM
<table width = "500" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"> <tr> <form action="multiple_upload_ac.php" method="post" enctype="multipart/form-data" name="form1" id="form1"> <td> <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"> <tr> <td><strong>Multiple Files Upload</strong></td> </tr> <tr> <td>Select File: <input name="ufile" type="file" id="ufile" size="50" /></td> </tr> <tr> <td>Select File: <input name="ufile" type="file" id="ufile" size="50" /></td> </tr> <tr> <td>Select File: <input name="ufile" type="file" id="ufile" size="50" /></td> </tr> <tr> <td align="center"><input type="submit" name="Submit" value="Upload" /></td> </tr> </table> </td> </form> </tr> </table>
This is the form.. and next will be the processing part of it...
<?php echo $HTTP_POST_FILES['ufile']['name']; echo "<br>"; echo $HTTP_POST_FILES['ufile']['name']; echo "<br>"; echo $HTTP_POST_FILES['ufile']['name']; echo "<br>"; ?>
This is a simple way to do it... I haven't actually tested this code yet as I got it before I actually needed it.. You may have to throw some mysql queries into the second file to make the file location and name etc be entered into a database.. then on the output you would query the database again requesting the url of each download and parsing them out using something like this
echo "<a href=\"'$file'\">Download 1</a>";
and it's really that simple.. as far as the login there are tons of login script examples which will also help you get familiar with php and mysql -- in fact in the tutorials section on this site i believe there is a login example.. if you cant find it let me know and i'll post one...
Posted 28 August 2006 - 02:30 AM
Posted 28 August 2006 - 02:33 AM
Simplify your life. If you are the only person able to upload files and you want to restrict them to a particular type, then use FTP or your File Manager to move them to your site. You'll have that working in a minute - must faster then implementing some password protected file uploader script.
I wish I could simplify my life.. Though with the project I am working on it's impossible to simplify it any more than I already have without using pre-made code... My tutorial site I'm coding everything -- forums included.. It's proving to be a pain in the ass but oh well thats okay...
Working on the admin console right now --- plus i'm using a template engine that I ended up re-writing to make work and so yeah.. simplify my life seems impossible at this point.. though for this guy -- seems like a valid idea...
Posted 28 August 2006 - 04:47 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users