basename is looking for a file and $HTTP_POST_FILES[$name]['name'] is not a valid path to a file. Something like this should work if(move_uploaded_file($_HTTP_POST_FILES['upfile']['tmp_name'], rawurlencode($store_dir.$HTTP_POST_FILES['upfile']['name'])) On Fri, 2005-01-28 at 14:41 +0900, Dave wrote: > 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@xxxxxxxxxxxxxxx > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php