Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Uploading Files, Let's do it! :)
FaLgoR
post Jan 17 2005, 07:06 PM
Post #1


Super Member
*********

Group: Members
Posts: 217
Joined: 2-January 05
Member No.: 3,084



Here, I'll show you how to upload files to the server by your browser.

upload.php:

CODE

<?
$sizelimit = "280000"; // file size limit
$patch = "/home/yoursite/public_html/files"; // patch to where the uploaded files will be saved - change it

if($file != ""){ // if $file is set
$file_ext = explode(".",$file_name); // check for the extension

if($file_size > $sizelimit) // check if file size is bigger than the limit
die("This file is too big.");

if(($file_ext[1] == "exe") && ($file_ext[1] == "bat")) // check for invalid files: add how extensions you want
die("File extension forbidden!");

if(file_exists("$patch/$file_name")) // check if this file is already in your server
die("There is another file with the same name in this server!");

if($file_ext[2]) // file.hi.exe - it is for security that this files will not be uploaded
die("Invalid file name!");

$title = stripslashes($title); // security reasons
$file_name = stripslashes($file_name); // security reasons
$file_size = stripslashes($file_size); // security reasons
$description = stripslashes($description); // security reasons

if(@copy($file,"$patch/$file_name")) // if the file has been suceful uploaded
die("
<p align=\"center\">The file has been uploaded!<br><Br>
<a href=\"index.php\">Back to the main page</a><br>
<a href=\"upload.php\">Send another file</a>
</p>
"); // show this message
}else{ // if the file isn't set, show the form
?>
<form action="<? echo "$PHP_SELF"; ?>" method="post" enctype=multipart/form-data>
<table border="0">
<tr>
<td width="100">File:</td>
<td><input type="file" name="file" size="30"></td>
</tr>
</table>
<p align="center">
<input type="submit" value="Send file">
</p>
</form>
<?
}
?>


Well here we are! It can be used for an "Send your file" pages for members, but remember that this code can be dangerous if not used with security. I hope this code don't create much problems just like my topic with an login sistem, but, if u find any problems, post it here.

Thx
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. How To Transfer Files Directly From My Computer To The Trap17 Account(6)
  2. Does Using Google Adwords To Advertise Work?(5)
  3. Let's Celebrate Four Years Of Saint Michael(22)
  4. Firefox 2 To Firefox 3 - Is It Worth Upgrading?(64)
  5. Deny Or Grant Users Access To Files Of Choice (vista)(3)
  6. Does Anyone Know How To Make Exe Files(19)
  7. X Files: I Want To Believe!(2)
  8. Olympic Basketball- Who Will Get The Gold Medal?(14)
  9. How To Download Any Flv Files From Any Sites(6)
  10. How To Create Pdf Files Using Free Tool(0)
  11. Sharing Files And Printer Between Windows Vista And Xp(9)
  12. Clearing Your Ie Tif(0)
  13. How To Disable "show Hidden Files And Folders" In Folder Option(12)
  14. Eclipse Exporting .jar Files(5)
  15. Panasonic Lumix - Problems With Movie Files(0)
  1. Browse System Files In The Browser...(2)
  2. The New And Very Good Free Host Server(13)
  3. Lan Surfer In Linux(2)
  4. Firefox Temporary Media Files(0)
  5. 1350 Great Free Logos (jpg + Psd)(8)
  6. Jar Executable Files(3)
  7. Naming Web Page Files(9)
  8. Audio Files?(5)
  9. Auto-upload Files With Filezilla And Autohotkey(0)
  10. How Can You Get Audio Files From Itunes Videos?(1)
  11. Jagged Alliance Fans(5)
  12. Converting Video Files From One Format To Another(6)
  13. Informix To Sql Server (or How To Open .unl Files)(2)
  14. Converting Audio Files In Vista(7)
  15. Best Way To Transfer Files(6)


 



- Lo-Fi Version Time is now: 13th October 2008 - 02:04 PM