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
Secure File Upload In PHP Web Applications article
Collapse
X
-
UPLOAD.PHP
Easy Dont need too worry no more lolCode:<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"]); } } ?>
32982398u2.gif
qw9r1q2ur9.zip
wuiusadf9.txt
39riweeswikfj.jar
this works real good can't execute php script with out the php in the name...
Leave a comment:
-
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
Tags: None
Leave a comment: