Jump to content
xisto Community
Sign in to follow this  
FaLgoR

Uploading Files Lets do it :)

Recommended Posts

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

upload.php:

<?$sizelimit = "280000"; // file size limit$patch = "/home/yoursite/public_html/files"; // patch to where the uploaded files will be saved - change itif($file != ""){ // if $file is set$file_ext = explode(".",$file_name); // check for the extensionif($file_size > $sizelimit) // check if file size is bigger than the limitdie("This file is too big.");if(($file_ext[1] == "exe") && ($file_ext[1] == "bat")) // check for invalid files: add how extensions you wantdie("File extension forbidden!");if(file_exists("$patch/$file_name")) // check if this file is already in your serverdie("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 uploadeddie("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 reasonsif(@copy($file,"$patch/$file_name")) // if the file has been suceful uploadeddie("<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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.