PDA

View Full Version : نشان دادن فایل به کاربر بعد از uplaod کردن فایل



صنم
شنبه 08 فروردین 1388, 09:53 صبح
سلام
من یک فرم دارم که کاربر از طریق آن می تواند فایلهای powerpoint را به سرور upload کند.کد زیر این کار را برای من انجام می دهد :


if (File1.PostedFile !=null) //Checking for valid file
{
// Since the PostedFile.FileNameFileName gives the entire path we use Substring function to rip of the filename alone.
string StrFileName = File1.PostedFile.FileName.Substring(File1.PostedFi le.FileName.LastIndexOf("\\") + 1) ;
string StrFileType = File1.PostedFile.ContentType ;
int IntFileSize =File1.PostedFile.ContentLength;
//Checking for the length of the file. If length is 0 then file is not uploaded.
if (IntFileSize <=0)
Response.Write(" <font color='Red' size='2'>Uploading of file " + StrFileName + " failed </font>");
else
{
File1.PostedFile.SaveAs(Server.MapPath("./powerpoint/" + StrFileName));
Response.Write( "<font color='green' size='2'>Your file " + StrFileName + " of type " + StrFileType + " and size " + IntFileSize.ToString() + " bytes was uploaded successfully</font>");
}
}
}

حالا من می خوام که مثل بعضی از سایتها که بعد از upload کردن فایل ، آن را به کاربر نشان میدهند(عکس صفحه اول فایل که در زیر آن اسم فایل آمده است) چه جوری باید این کار را انجام بدهم ؟
با تشکر