This is a discussion on "help with upload with ID script" within the PHP Forum section. This forum, and the thread "help with upload with ID script are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
help with upload with ID script
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Hey Im looking to create a simple upload and download system... I want a simple upload with size and file type limits and built in expirery, say 90 days. I also want to give the upload an ID number so that when a user has completed the upload they are given an ID number.. this number will be used for downloading. When a user comes to download they go to a download page and merely enter the ID number and the download commences... So the whole process would start with an upload box... the upload would start.. upon completion the user is ttaken to an upload successfull page which also echos the ID number the file has just been given... the user could share this number with friends.. and they would go to the download item page and enter the number, click submit and the download would start. Where do I start? I'm a total n00b but heres how I imagine it would work... Upload Page: Form with browse and upload buttons... <unknown script> which would assign the upload a randomly generated but non repetitive ID number which would probably be stored in a mysql database and points to the file and its location... also the file might also be stored in mysql form (maybe) or as a normal file in a specified directory on the host server. Download Page: Another form with an input box... data submited to the input box would use another <unknown script> to call or select from the database the corrisponding ID number and file name and commence the download.. And since all this would require database I assume a config would be needed to define the database details as well as the allowed types, sizes.. length of storage before removal ie 90 days and other things... I also imaging this config would contain defined values like the ones where you tell it that header is such a file and to call it you use $header or something like that... Any pointers or tutorials to get me started on this? Complete n00b remember.. I wanted to start with something like this cos it seemed simple (ish) and it is something I need Thanks guys... Also.. If people dont mind.. I will be around asking lots of questions while I create this cos as I said.. Im a total n00b when it comes to building scripts from scratch. Thanks guys!!! |
|
|
|
|||
|
Re: help with upload with ID script
Hi Micky,
First question has to be what sort of hosting do you have? Free or paid for and what facilities do you have available. You are going to need a database to manage the file names, location and their respective access code. Look at using the php function crypt(); to produce your code. If you use the datetime as a seed, there should be little chance of producing a duplicate code and anyway you could always check against the database before issuing that code and if it already exists, bin it and generate another one. I would be inclined to just keep the files in a directory and just keep a reference to them in the database. You can specify in your php script handling the upload such things as file types, max size, etc. and reject if not allowed. It's not something you can achieve with JavaScript at the client end before upload as you don't have the file access rights. Start reading and working on your code and come back with specific questions otherwise replies could get a bit long winded. |
|
|||
|
Re: help with upload with ID script
Hey,
thanks for the reply. I currently have paid hosting.. 25GB storage.. 1TB xfer bandwidth.. unlimited MySQL databases and php 4 0r 5 or I can install my own php to my domain if needed so I can alter the php.ini if needed to turn certain things on or off Ok so I have been reading here for some of the basics http://www.tizag.com/phpT/ and also http://www.tizag.com/mysqlTutorial/index.php As I figure they cover the basics.. I have learned HTML and I have played around with PHP but do not fully understand it yet.. So I'm hoping these small project exercises will help me So where to start? I presume I would start with the upload form first and also the config? //EDIT I have started my form and insert script here FORM
Now Im going to use this tutorial here http://www.tizag.com/mysqlTutorial/mysqltables.php to create a table to store this data in a test database I created. I have a question about this part
Last edited by Micky-D; Sep 20th, 2006 at 23:46. |
|
|||
|
Re: help with upload with ID script
Hi Micky
Just to let you know I'm not ignoring you. Will get back to you later in the day. |
|
|||
|
Re: help with upload with ID script
It should be:
Do not use deprecated or propriatory tags like <center>. At the moment, your php script will continue to run even if the database connection fails. You need to include in your response to a failed connection an 'exit;' command. This will terminate the script. I don't see any point to this bit:
You are going to need some data validation routines. Not only to check that the fields contain appropriate data but also that they don't contain anything nasty where some miscreant has attempt what is known as an sql injection attack. Your insert sql can just be:
$result = mysql_query($sql, $cid); Carry on the good work. |
|
|||
|
Re: help with upload with ID script
hey.. no worries buddy.. Im just adding to this thread as I go anyway.. kind of like a reference and progress post.. hopefully others will learn from my triumphs and mistakes
Well, It has taken me 5 hours to develop this script so far.. and at the minute its a shell... just a trial for inserting and recalling data.. I plan to build on to this to create my upload and crypt() script.. Currently I have created the following files.. FORM
I created this with the help of 2 or 3 tutorials I found.. most of the script is hand written.. some parts have been copied and modified to my needs as best as I can but I am really impressed that I created this and as simple as it is.. it works... WOOOOOOOOT Ok so theres a few things I need to alter... well lots actually if I want this form to perform the things I need I do have a few questions for now however... How do I crypt the data in the input text area and then decrypt it when I need to call it back? How can I alter the section of the form that displays the inserted data to only show the last entry as opposed to all the entrys and table name? |
|
|||
|
Re: help with upload with ID script
Damn.. in all this time I never noticed you answered me before I replied lol...
Cheers buddy.. Im gonna go look at your advice and apply it to my script tonight once I have gotten my daughter off to sleep Many thanks buddy.. I dare say we will speak soon lol! Thanks again |
|
|||
|
Re: help with upload with ID script
EXIT Positioning..
I added it to my coinfig.php mysql connect code. |
|
|||
|
Re: help with upload with ID script
Quote:
The removed code is because die is an equivalent of exit. |
![]() |
| Tags |
| help, upload, script |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Upload script + classifeds | marie2007 | Starting Out | 3 | Jul 28th, 2007 17:35 |
| Upload script | Perad | PHP Forum | 4 | Nov 27th, 2006 23:40 |
| Upload Script | scopeweb | PHP Forum | 3 | Nov 27th, 2005 05:55 |
| A not workin php upload script, need help?? | ice-o | PHP Forum | 3 | Feb 27th, 2005 09:31 |
| ASP upload script | GillBates | Classic ASP | 0 | Nov 24th, 2003 13:54 |