ok, so I got the timestamp prepended, and I decided I don't really care about stripping it off for the download. All I really care about is removing any possible spaces in the filenames. Here's what I have:
$file_dir = "/home/httpd/vhosts/babysteps.tv/httpdocs/counterpoint/uploads";
$file_url = "http://babysteps.tv/counterpoint/uploads";
if ( isset ( $_FILES ) ) {
foreach( $_FILES as $file_name => $file_array ) {
if ( is_uploaded_file ( $file_array['tmp_name'] ) ) {
$time = time();
$safe_filename = $time."-".$file_array['name'];
$filename = $file_array['name'];
move_uploaded_file( $file_array['tmp_name'], $file_dir.'/'.$safe_filename )
or die ( "Couldn't Copy" );
$file_query = "INSERT INTO notefiles ( noteid, clientid, topic, filename, safe_filename )
VALUES( '$noteid', '$id', '$topic', '$filename', '$safe_filename' )";
if( ! mysql_query( $file_query, $link ) ) {
die("Could not execute query: ".mysql_error());
}
}
}
}
Its a loop for a page where I have four possible uploads at a time. They all get the same timestamp, but thats not a problem. Where do I check for the spaces and replace them?
cheers,
Jason