note 70503 added to function.copy
| From: | info at mihalism dot com | Date: | Thu, 19 Oct 2006 04:53:17 +0000 |
| Subject: | note 70503 added to function.copy | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-118738@lists.php.net to get a copy of this message | ||
This is a simple URL uploader that uses the copy() function it does not include a file size check or
file type check because i dident have the time well here it is
<html><head><title>Simple URL upload copy()</title></html><body
bgcolor='#FFFFFF'><?php
$updir = "url_uploads/"; //storage directory
if(!is_dir($updir))
{
mkdir($updir);
chmod($updir, 0777);
}
if($_GET['option'] == "url_up"){
$nfile = $_POST['nfile']; //post new file name the n is for new
$ofile = $_POST['ofile']; //post old file the o is for old
if(!$nfile)
{
echo "No new file name entered";
exit;
}
elseif(!$ofile)
{
echo "No URL entered";
exit;
}
else
{
//this is a simple upload so we are going to use the copy() function
if(!copy($ofile, $updir.$nfile))
{
echo "Error while uploading please try again";
exit;
}
else
{
echo "File was uploaded to server <br/><br/> Old file <a
href='$ofile'>$ofile</a> <br/> New file <a
href='$updir$nfile'>$nfile</a>";
}
}
}
else
{
echo "Simple URL upload copy() <br/><br/> <form
action='?option=url_up' method='post'>URL to upload : <input
type='text' name='ofile' style='width:250px'><br/>New file
name : <input type='text' name='nfile' style='width:250px'>
<br/><br/> <input type='submit' value='Upload
URL'></form>";
}
?>
</body></html>
----
Server IP: 216.194.113.175
Probable Submitter: 68.230.193.51
----
Manual Page -- http://www.php.net/manual/en/function.copy.php
Edit -- https://master.php.net/note/edit/70503
Del: integrated -- https://master.php.net/note/delete/70503/integrated
Del: useless -- https://master.php.net/note/delete/70503/useless
Del: bad code -- https://master.php.net/note/delete/70503/bad+code
Del: spam -- https://master.php.net/note/delete/70503/spam
Del: non-english -- https://master.php.net/note/delete/70503/non-english
Del: in docs -- https://master.php.net/note/delete/70503/in+docs
Del: other reasons-- https://master.php.net/note/delete/70503
Reject -- https://master.php.net/note/reject/70503
Search -- https://master.php.net/manage/user-notes.php