Ad block is installed and active. Please support us by disabling it.
HomeMonday, January 22, 2018, 18:21:28
1

Upload File with PHP

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

View content in a zip file with PHP

List all files in a zip archive with PHP

Email Link

HTML email link example

PHP Cookies - setcookie

Defines a cookie to be sent along with the rest of the HTTP headers.

Link Base Pro :: Free Link Index Script

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.

Captcha V1 - Free PHP Script

An anti-spam form protection image written in PHP, Version: 1.1.

PHP Fwrite : fwrite

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

Stack Overflow Clone Script - Ja2BU

Open source question and answer script written in PHP, MySQL and jQuery. Main features are: SEO friendly url's, private message system, rating system, comments system.

PHP $_SESSION

Session_start creates a session or resumes the current one based on a session identifier passed via a GET or POST request, or passed via a cookie.

Sitemap

phpForm.net Website Sitemap

Addslashes - Stripslashes

addslashes — quote string with slashes, stripslashes — un-quotes a quoted string
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.