Ad block is installed and active. Please support us by disabling it.
HomeSunday, August 20, 2017, 22:50:34
1

Upload Attachment - PHP Tutorial

Tuesday, February 10, 15, 10:33:26, 3 Yaers Ago Via wain, Hits: 3151
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

Upload and Resize an Image with PHP

Tutorial - How to upload and resize image with PHP

E-Cards 1.1. PHP Script

This script will allow your visitors to send e-cards to their friends. It features admin notification and HTML output.To use the "e-cards" script completely free , the "powered by" link at the bottom of the pages must stay intact.

PHP Form Validation

PHP form validation :: PHP tutorial, requirement(s): PHP Server

How to check checkbox checked

Checking if checkbox is checked with jQuery

Password Protect With PHP

Password protect tith PHP - tutorial

PHP Redirect

Header (location) redirect must be processed before any output to the browser.

PHP Write to File

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

How to insert new line (IP Address) with fwrite

How to insert new line (IP Address) with fwrite, Get IP address and write to file.

PHP File Create

Create and write data to a file using the php frwite function.

Jquery PHP Contact Form

This script allows your visitors to send you an email directly from your website.
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.