我想在我的项目中上传照片和签名 [英] I want to upload photo and signature in my project
本文介绍了我想在我的项目中上传照片和签名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨朋友们
我想在我的项目中上传照片..保存到服务器..图像控件中的图像反转......还想要在文本框中保存图片网址
请帮助我..
目前我正在进行在线录取程序。
感谢先进的
Hi friends
I want to upload photo in my project..photo save to the server..and image retrive in image controls...and also want to save image url in textbox
Please help me ..
Presently i am working on Online admission procedure.
Thanks in advanced
推荐答案
尝试这个可能有帮助..
Try this if could help..
// This code download an image attachment from server...
protected void lnkAttachment_Click(object sender, EventArgs e)
{
LinkButton lnkAttachment = (LinkButton)sender;
GridViewRow row = (GridViewRow)lnkAttachment.NamingContainer;
var fileName = ((LinkButton)row.FindControl("lnkAttachment")).Text;
string sourcePath = Server.MapPath("~/Attachment/Contract/");
string sourceFle = (Server.MapPath("~/Attachment/Contract/" + fileName.ToString()));
string targetPath = this.txtTargetDir.Text;
string targetFle = targetPath + "\\" + fileName;
string result = string.Empty;
this.txtAttachment.Value = string.Empty;
if (!Directory.Exists(targetPath))
{
var ok = System.IO.Directory.CreateDirectory(targetPath);
}
if (!File.Exists(sourceFle ))
{
Tools.MessageBox.Show(this.Page, "Could not foud\\n" + sourceFle);
string uploadedFile = sourceFle;
string resultMes = cCmd.DeleteUploadFileName(uploadedFile);
List<contract_attachmnt> lst = new List<contract_attachmnt>();
lst = cCmd.GetAttachment(this.hfContracNo.Value);
BindAttachment(lst);
return;
}
try
{
Response.ContentType = "application/ms-excel";
var attachmentFle = "attachment; filename=" + fileName;
Response.AppendHeader("Content-Disposition",attachmentFle);
var xx = Path.GetTempPath();
Response.TransmitFile(sourceFle);
Response.End();
}
catch (Exception)
{
result = "Error in downloading file.";
}
Tools.MessageBox.Show(this.Page, result);
}
</contract_attachmnt></contract_attachmnt>
问候,
Regards,
这篇关于我想在我的项目中上传照片和签名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文