![]() |
|
|
|||||||
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
||
|
Recently someone asked for an Upload script, so here you go, out my pure PHP.
First we need to create the database table with the following SQL: Code:
CREATE TABLE `uploads` ( `id` int(10) unsigned NOT NULL auto_increment, `whenuploaded` datetime NOT NULL default '0000-00-00 00:00:00', `ipaddress` varchar(15) NOT NULL default 'unknown', `imageloc` varchar(255) NOT NULL default 'unknown', `imagesize` int(10) unsigned default NULL, `imagetype` varchar(30) default NULL, PRIMARY KEY (`id`) ) TYPE=MyISAM; Then here's the PHP code you need at the top of the page where you're going to have your upload form. You need to change the database access details at the top and the 'defines' to specify your domain and path names. Create the DEST_DIR directory on the server with 777 permissions. PHP Code:
And here's your form, which goes on the same page as the PHP script above. HTML Code:
<form action="<?php $PHP_SELF ?>" method="post" enctype="multipart/form-data" name="form_uploader" id="form_uploader">
<table border="0" align="center" cellpadding="1" cellspacing="1">
<tr>
<td colspan="3">
<div align="center"><?php echo $errormessage; ?></div>
</td>
</tr>
<tr>
<td>File:</td>
<td colspan="2">
<input name="MAX_FILE_SIZE" type="hidden" value="<?php echo MAX_ALLOWED_FILE_SIZE ?>">
<input name="picfile" type="file" id="picfile" title="Enter the path to the file you wish to upload, or use the Browse button to get a file selection dialog." size="60" maxlength="250">
<input name="form_submit" type="hidden" id="form_submit" value="form_uploader">
</td>
</tr>
<tr>
<td colspan="3">
<div align="center">
<input name="Submit" type="submit" title="Press this button to start the upload." value="Upload">
</div>
</td>
</tr>
</form>
__________________
http://img76.imageshack.us/img76/6450/sc2but4ng.gif | http://img495.imageshack.us/img495/...ogorwtan0je.gif | <a href="http://webtools.sc2.info"><img src="http://img129.imageshack.us/img129/8682/sc2webtan7ju.gif" border="1" width="100" alt="Free Webtools for all" /></a> | <a href="http://www.indexrated.com"><img src="http://img398.imageshack.us/img398/4813/listed1pb.gif" border="1" width="100" alt="Index Rated Directory - Rating Quality Sites" /></a> Get all Games,Apps and Wallpapers Nokia, Samsung and Sony Erricson!! |
|
|
|
||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|