HomeFriday, June 23, 2017, 06:57:30
1

Upload File with PHP

Tuesday, February 10, 15, 13:27:18, 2 Yaers Ago Via wain, Hits: 2514
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

Advanced Contact Form - PHP Script

Advanced Contact Form with email and form field validation. Features: HTML Output(Response), Captcha Image.

PHPBB3 Shoutbox

Vesion: 1.1. Released: 08/08/10, Licence GNU, Price: Free

PHP File Create

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

PHP Tutorials

Useful step-by-step PHP tutorials for beginners

How to set up password for phpMyAdmin in Wamp Server

Password for phpMyAdmin in Wamp

Random MySQL Query

Random MySQL query, requirement(s): PHP Server, MySQL

Smarty - Create dynamic Web Pages with PHP & MySQL

Creating Dynamic Web Pages Using Smarty and MySQL - Requirement(s): PHP Server, MySQL

PHP Fwrite : fwrite

php write to file - how to write data to a file using the php frwite function

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.

Email Link

HTML email link example
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.