Maison >développement back-end >tutoriel php > 需把一简单php代码转为asp.net2.0或更高版的代码解决思路
需把一简单php代码转为asp.net2.0或更高版的代码
下面的是全部源码,没有几行,主要是没有学过php,对于学过的应不是什么问题
$imageDirectory = $_GET[ 'seed '];
if(!is_dir( "./images/uploaded/$imageDirectory ")) mkdir( "./images/uploaded/ ", 0755);
$dotLocation = strrpos($_FILES[ 'Filedata '][ 'name '], '. ');
$newFileName =sanitizeText(substr($_FILES[ 'Filedata '][ 'name '], 0, $dotLocation)) . substr($_FILES[ 'Filedata '][ 'name '], $dotLocation);
move_uploaded_file($_FILES[ 'Filedata '][ 'tmp_name '], "./images/uploaded/ " . $newFileName);
chmod( "./images/uploaded/ ".$_FILES[ 'Filedata '][ 'name '], 0777);
function sanitizeText($text)
{
$title = strip_tags($text);
$title = preg_replace( '|%([a-fA-F0-9][a-fA-F0-9])| ', '---$1--- ', $title);
$title = str_replace( '% ', ' ', $title);
$title = preg_replace( '|---([a-fA-F0-9][a-fA-F0-9])---| ', '%$1 ', $title);
$title = strtolower($title);
$title = preg_replace( '|/+| ', '- ', $title);
$title = preg_replace( '/&.+?;/ ', ' ', $title); // kill entities
$title = preg_replace( '/[^%a-z0-9 _-]/ ', ' ', $title);
$title = preg_replace( '/\s+/ ', '- ', $title);
$title = preg_replace( '|-+| ', '- ', $title);
$title = trim($title, '- ');
return $title;
}
?>
------解决方案--------------------
string imageDirectory = resquest.queryString('seed ');
------解决方案--------------------