Ad block is installed and active. Please support us by disabling it.
HomeWednesday, April 25, 2018, 08:55:46
1

Upload File with PHP

Tuesday, February 10, 15, 13:27:18, 3 Yaers Ago Via wain, Hits: 6355
Basic file uploading with PHP
Example:

Code:
<?php
if(isset($_POST['Submit']))
{
$current_file=$_FILES['file']['name'];
$extension = substr(strrchr($current_file, '.'), 1);
if (($extension!= "txt") && ($extension != "zip"))
{
die('Unknown extension');
}
$time = date("fYhis");
$new_file = $time . "." . $extension;
$destination="uploads/".$new_file;
$action = copy($_FILES['file']['tmp_name'], $destination);
if (!$action)
{
die('File copy failed');
}else{
echo "File copy successful";
}
}else{
?>
<form method="post" enctype="multipart/form-data" action="submit.php">
<input type="file" name="file" ><br />
<input type="submit" name="Submit" value="submit">
</form>
<?php
}
?>

Sign In

Sponsor

Related

Comments 1.1. :: PHP Script

This script allows your visitors to add comments to any single page on your web site.

MySQL Tutorials

MySQL tutorials, MySQL training, learn MySQL, MySQL Tutorial with practical examples.

Contact Us Form With Captcha

A contact us form with email and form field validation. It allows your visitors to send you an email directly from your website. Features: Captcha Image, HTML output.

Email Link

HTML email link example

PHP Cookies and Sessions Tutorial

PHP Cookies and Sessions Tutorials

Upload Image With PHP

[Example3] Tutorial - How to upload image in php.

Link Base 1.1. - Free PHP Link Index Script

Manage your links using a MySQL database. Features easy install, user submission, and an admin panel to add, edit and remove categories and links.

Adsense crawler errors and robots.txt

How to fix Google AdSense crawler errors in robots.txt

Math Captcha V6

PHP Math Captcha Image Version 6

MySQL Basic Functions

MySQL Basic Functions - select, delete, update..
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.