<%
$max_bookmarks_file_size = 24000;
$f = $_FILES[$field_name]['name'];
if( $f ) {
if( preg_match( "/\.htm$/", $f ) || preg_match( "/\.html$/", $f )) {
if( $_FILES[$field_name]['size '] < $max_bookmarks_file_size ) {
if( !is_dir( $dir ) ) {
$old_umask = umask(0);
mkdir( $dir );
umask($old_umask);
}
if( !is_dir( $dir ))
warn( "Your user folder could not be created." );
else if( ! is_writable( $dir ))
warn( "Your folder was not writable." );
$tmp = $_FILES[$field_name]['tmp_name'];
if( move_uploaded_file($tmp, $path)) {
# fix perms:
chmod( $path, 0666 );
# we will start importing now
$show_form = false;
} else warn( "Couldn't move the uploaded bookmarks file ($tmp) to your user directory ($dir) for importing -- please contact the administrators..." );
} else warn( "We require that your favorites file be smaller than " . ($max_bookmarks_file_size / 1024) . "k." );
} else warn( "Your bookmarks file should end in .htm or .html" );
}
%>