Ad block is installed and active. Please support us by disabling it.
HomeFriday, April 20, 2018, 20:00:43
1

Upload Attachment - PHP Tutorial

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

Getimagesize

Getimagesize function will determine the size of any given image file and return the dimensions along with the file type and a height/width text string to be used inside a normal HTML IMG tag and the correspondant HTTP content type.

Link Base L.1.1.

This script allows you to manage your links using a MySQL database. It features easy install, user submission, and an admin panel to add, edit and remove categories and links. The script is easy to customize to suit your needs.

Sitemap

phpForm.net Website Sitemap

Jquery - Formatting International Phone Numbers

How to format international telephone numbers with jquery

PHP Write to File

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

PHP Cookies and Sessions Tutorial

PHP Cookies and Sessions Tutorials

HTML Button Generator

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

PHP Trim

trim() Strip whitespace (or other characters) from the beginning and end of a string.

Inserting form data in MySql table

Inserting form data in MySql table with PHP

Syntax highlighting in Smarty

Syntax highlighting for Smarty - Google Code Prettify
About Author

wain

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