您的位置:首页 > 编程语言 > PHP开发

flash8上传文件后台代码-.Net,php,cf

2006-08-22 13:09 716 查看
cfm:
<cffile action="upload" fileField="Filedata" destination="#ExpandPath ('userUploads')#" nameConflict="makeUnique" />
C#.NET:
string saveToFolder = "savedFiles"
private void Page_Load(object sender, System.EventArgs e)
{
HttpFileCollection uploadedFiles = Request.Files;
string Path = Server.MapPath(saveToFolder);
for(int i = 0 ; i < uploadedFiles.Count ; i++)
{
HttpPostedFile F = uploadedFiles[i];
if(uploadedFiles[i] != null && F.ContentLength > 0)
{
string newName = F.FileName.Substring(F.FileName.LastIndexOf("\\") + 1);
F.SaveAs(Path + "/" + newName);
}
}
}
php:
<?php
//path to storage
$storage = 'userUploads';
//path name of file for storage
$uploadfile = "$storage/" . basename( $_FILES['Filedata']['name'] );
//if the file is moved successfully
if ( move_uploaded_file( $_FILES['Filedata']['tmp_name'] , $uploadfile ) ) {
echo( '1 ' . $_FILES['Filedata']['name']);
//file failed to move
}else{
echo( '0');
}
?>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: