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');
}
?>
<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');
}
?>
相关文章推荐
- 你不知道的文件上传漏洞php代码分析
- php编程文件上传代码
- 三步FTP实现PHP上传文件代码剖析
- php文件上传代码
- php实现上传图片文件代码
- PHP 文件上传后台处理脚本
- php多文件上传实现代码
- C#后台代码 Post 提交表单上传文件及其他信息
- php实现图片上传与文件上传的实现代码实例
- 本地文件上传到服务器 php代码
- 文件上传代码 -备忘(转PHP100教程)
- PHP上传多文件,多图片程序代码
- 文件上传下载PHP代码实现
- php文件上传错误代码
- 上传文件到php后台全过程
- PHP 文件上传功能实现代码
- 完整代码演示PHP上传多个文件
- php文件上传表单摘自drupal的代码
- 五分钟解决PHP上传文件代码演示
- php 实现多文件上传程序代码