Ad block is installed and active. Please support us by disabling it.
HomeFriday, September 22, 2017, 00:47:50
1

Upload File with PHP

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

Upload Image with PHP [Example2]

[Example2] Tutorial - How to upload and resize image with PHP

Preventing multiple form submissions

Preventing multiple form submissions

ShoutBox 1.1. PHP Script

ShoutBox allows your users to post short messages on your site. The script is lightweight and very easy to install and use.

Process Form Data with Jquery

jQuery, Process form data

PHP Form Action Self Submit

PHP form action self submit tutorial, requirement(s): PHP server

How to check checkbox checked

Checking if checkbox is checked with jQuery

Create dynamic Web Pages with PHP & MySQL

Create dynamic Web Pages with PHP & MySQL, Requirement(s): PHP Server, MySQL

Bookmark Script

Allow your users to easily bookmark your site, by clicking on a link on the page.

Creating a basic bad word filter in PHP

This tutorial will show you how to create a basic bad word filter in PHP

PHP str_replace

str_replace - This function returns a string or an array with all occurrences of search in subject replaced with the given replace value
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.