Secure File Upload In PHP Web Applications article

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Secure File Upload In PHP Web Applications article

    Secure File Upload In PHP Web Applications article
    its pdf file i couldnt upload here because size issue it may help someone

    link is here

    left wap stuff

    #2
    thanks Gill. Btw, you still angry? :D
    mysterio.al - programming is a functional art

    Comment


      #3
      Originally posted by Mysterio3 View Post
      thanks Gill. Btw, you still angry? :D
      no why should i angry ?enjoy its life mood change like day and night lol
      left wap stuff

      Comment


        #4
        UPLOAD.PHP
        Code:
        <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" enctype="multipart/form-data" name="file_upload">
        	<input type="file" name="file" id="file">
        	<input type="hidden" name="execute" id="execute">
        	<input type="submit" name="Submit" id="Submit" value="Submit">
        </form>
        
        <?php
        
        // Upload and Rename File
        if (isset($_POST['execute'])) {
         
        $filename = $_FILES["file"]["name"];
        $file_basename = substr($filename, 0, strripos($filename, '.')); // strip extention
        $file_ext = substr($filename, strripos($filename, '.')); // strip name
        $filesize = $_FILES["file"]["size"];
         
        	if (($file_ext == ".doc" || $file_ext == ".docx")  &&  ($filesize < 200000)) {
        		// rename file
        		$newfilename = md5($file_basename) . $file_ext;
         
        		if (file_exists("upload/" . $newfilename)) {
        			// file already exists error
        			$error = "You have already submitted this file.";
        		} else {
        			move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $newfilename);
        			echo "File uploaded successfully.";
        		}
        	} elseif (empty($file_basename)) {
        		// file type error
        		$error = "Please select a file to upload.";
        	} else {
        		// file selection error
        		$error = "Only doc, docx, rtf, pdf, and txt files can be submitted online.";
        		unlink($_FILES["file"]["tmp_name"]);
        	}
        }
        ?>
        Easy Dont need too worry no more lol

        32982398u2.gif
        qw9r1q2ur9.zip
        wuiusadf9.txt
        39riweeswikfj.jar

        this works real good can't execute php script with out the php in the name...

        Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
        Visit: WapMasterz Coming Back Soon!
        _______
        SCRIPTS FOR SALE BY SUBZERO
        Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
        FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
        _______
        Info & Tips
        php.net
        w3schools.com

        Comment


          #5
          More light pls, i dont stil understand
          http://myfacepals.com
          MYFACEPALS SOCIAL NETWORKsigpic

          Comment


            #6
            that script i post there will not let users to upload php chell scripts

            they can't execute php script with out the php in the name...

            Read better mate next time i did tell ya about it
            Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
            Visit: WapMasterz Coming Back Soon!
            _______
            SCRIPTS FOR SALE BY SUBZERO
            Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
            FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
            _______
            Info & Tips
            php.net
            w3schools.com

            Comment

            Working...
            X