Ad block is installed and active. Please support us by disabling it.
HomeSunday, December 17, 2017, 04:23:43
1

Upload Attachment - PHP Tutorial

Tuesday, February 10, 15, 10:33:26, 3 Yaers Ago Via wain, Hits: 3837
Upload attachment with PHP example, Requirement(s): PHP server
Download:
http://phpform.net/download.php?f=attachment.zip

Code:
<?php
if(isset($_POST['query'])) {
@$option = $_POST['option'];
@$attacname = $_POST['attacname'];
if($option == 1) {
$current_file = $_FILES['file']['name'];
$extension = substr(strrchr($current_file,'.'),1);
if(($extension != "txt") && ($extension != "zip")) {
echo 'Unknown extension';
include ('static.php');
die();
}
$time = date("fYhis");
$new_file = $time.".".$extension;
$destination = "attachments/".$new_file;
$action = copy($_FILES['file']['tmp_name'],$destination);
if(!$action) {
echo 'File copy failed';
include ('static.php');
die();
} else {
echo $attacname." - File copy successful";
}
} else {
echo "The checkbox is not checked";
}
} else {
?>
<form action="index.php" method="post" enctype="multipart/form-data" name="form">
Upload attachment: <input class="incc" type="checkbox" name="option" value="1" />
<br />
Only .txt .zip files: <input type="file" name="file" />
<br />
Attachment Text:
<br />
<input type="text" name="attacname" /><br />
<input type="submit" value="submit" name="query" />
</form>
<?php } ?>

Sign In

Sponsor

Related

Creating a Math CAPTCHA with PHP - PHP Tutorial

This tutorial will show you how to create a form with Math Captcha.

PHP Write to File

PHP Write to File :: PHP Tutorial, requirement(s): PHP server

Block Visitors From Specific IP Address

Learn How To Restrict Users From Different IP Addresses.

MySQL Basic Functions

MySQL Basic Functions - select, delete, update..

PHP Date Examples

Returns a string formatted according to the given format string using the given integer timestamp or the current time if no timestamp is given.

Email to Friend - PHP Script

This form allows your visitors to suggest your site to a friend. It features an HTML email format and an admin notification email.

Captcha V1 - Free PHP Script

An anti-spam form protection image written in PHP, Version: 1.1.

Math Captcha V6

PHP Math Captcha Image Version 6

Link Generator PHP Script

This script will allow your visitors to create links online.To use the "link generator" script completely free , the "powered by" link at the bottom of the pages must stay intact.
About Author

wain

Date Registered: Sun, Feb 8, 15
Last Time Online: Thu, Jun 15, 17
So far has created 115 entries.
wain
This author has not yet filled in any details.