file super global and functions

From: Date: Thu, 01 Apr 2004 00:18:42 +0000
Subject: file super global and functions
Groups: php.general 
Request: Send a blank email to php-general+get-181985@lists.php.net to get a copy of this message
hello all i've a problem, serious one. how can i pass the name of a file upload to a function ? i need to do the upload of 1 file, but want to use a function, so that the main file stays small the problem is, when passing the file name, throw the $_FILES super global , is not recognized in the function... here is the code: ############ the function (or part of it) function uploadfile ($userfile, $name2file,$uploadir) { //userfile is where file went on webserver echo 'inside'; <<< ---- debuging purpose $userfile = $_FILES['userfile']['tmp_name']; //userfile_name is original file name $userfile_name = $_FILES['userfile']['name']; echo 'User File name: '.$userfile_name; <<< --- debuging purpose ############## main program ##################33 uploadfile ($_FILES['user_picture'],$_SESSION['valid_user'].'_picture',$USERPICS); this is the call to the function above the problem is that inside the function, the file name is not recognized... when i try to print the filename, is empty .... any ideas ???? it only works if $_FILSE['user_picture'] is $userfile ...... should i pass the values by reference ?i mean, putting some sort of & ?? cheers and best regars Bruno -- ----------------------------------------------------- .-'''''-. .' `. : : : : : _/| : Bruno Santos : =/_/ : brvds@netvisao.pt `._/ | .' ( / ,|...-' Pagina Pessoal \_/^\/||__ http://feiticeir0.no-ip.org _/~ ""~"` \_ __/ -'/ -._ \_\__ /jgs /-' \ \ \-.\ "Written very small on the back poket of a girl's jeans - 'If you can read this, you're WAY too close.'"

« previous php.general (#181985) next »