note 78408 added to function.copy

From: Date: Wed, 10 Oct 2007 20:12:05 +0000
Subject: note 78408 added to function.copy
Groups: php.notes 
Request: Send a blank email to php-notes+get-131280@lists.php.net to get a copy of this message
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 -- https://master.php.net/note/delete/78408/integrated Del: useless -- https://master.php.net/note/delete/78408/useless Del: bad code -- https://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 -- https://master.php.net/note/delete/78408/in+docs Del: other reasons-- https://master.php.net/note/delete/78408 Reject -- https://master.php.net/note/reject/78408 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#131280) next »