List Info

Thread: note 78408 added to function.copy




note 78408 added to function.copy
user name
2007-10-10 15:12:05
A useful use for copy is when uploading files.

getUpload( [The name given to the file element in the form],
[the location to copy the upload to], [an alternative name],
[what you want the file chmod'd to] )
returns true or false.

<?php
function getUpload($name,$location,$fname='',$chmod=''){
	$upload=$_FILES[$name];
	if($fname==''){$fname=$upload['name'];}
	if($chmod==''){$chmod="0777";}
	$c=copy($upload['tmp_name'],$location.$fname);
	$m=chmod($location.$fname,$chmod);
	if(!$c||!$m){return(true);}else{return(false);}
}
?>
----
Server IP: 87.124.64.96
Probable Submitter: 86.158.149.109
----
Manual Page -- http:/
/www.php.net/manual/en/function.copy.php
Edit        -- https://master
.php.net/note/edit/78408
Del: integrated  -- h
ttps://master.php.net/note/delete/78408/integrated
Del: useless     -- http
s://master.php.net/note/delete/78408/useless
Del: bad code    -- htt
ps://master.php.net/note/delete/78408/bad+code
Del: spam        -- https:/
/master.php.net/note/delete/78408/spam
Del: non-english -- 
https://master.php.net/note/delete/78408/non-english
Del: in docs     -- http
s://master.php.net/note/delete/78408/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/78408
Reject      -- https://mast
er.php.net/note/reject/78408
Search      -- https://
master.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )