Re: [NEWBIE] Trying to create a function from an existing script

From: Date: Fri, 28 Jan 2005 05:41:42 +0000
Subject: Re: [NEWBIE] Trying to create a function from an existing script
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-207547@lists.php.net to get a copy of this message
Marek, Mark, Thanks for the advice. I've added "global $HTTP_POST_FILES;" into my function, and it is working.
    I'd also like to follow Marek's advice to modify my script, as it sounds like it helps to make it more secure. However, I don't think I'm using the syntax right. I changed:
if( copy($HTTP_POST_FILES['upfile']['tmp_name'],$store_dir.$HTTP_POST_FILES['upfile']['name']) to if ( move_uploaded_file($HTTP_POST_FILES[$name]['tmp_name'], $store_dir . basename($HTTP_POST_FILES[$name]['name']) ) ... because I looked up move_upload_file() in the manual, and it says it will return FALSE if it fails, so I thought I could encase it in an if() statement. But it's always returning false and not uploading the file. Have I got it wroing? -- Dave Gutteridge dave@tokyocomedy.com

« previous php.general (#207547) next »