freetextbox控件上传图片问题

a410787073 2010-10-20 04:33:15
freetextbox控件上传图片时报错说找不到ftb.imagegallery.aspx页面,我并没有把ftb.imagegallery.aspx 页面放在引用此控件的同一目录中,怎么才能自己控制ftb.imagegallery.aspx页面的位置!!!
...全文
80 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
wuyq11 2010-10-20
  • 打赏
  • 举报
回复
wuyq11 2010-10-20
  • 打赏
  • 举报
回复
HDR=NO 即无字段
HDR=yes 即有字段,一般默认excel表中第1行的列标题为字段名,如姓名、年龄等
如果连接字符串中指定 HDR=NO,Jet OLE DB 提供程序将自动为您命名字段(F1 表示第一个字段,F2 表示第二个字段,依此类推);
SELECT * into newtable
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="c:\a.xls";User ID=Admin;Password=;Extended properties=Excel 8.0')...[Sheet1$]
上传excel文档到服务器,再打开服务器上excel导入数据到数据库。
遍历excel,实现数据集更新,插入数据到数据库
using(OleDbConnection myConn = new OleDbConnection(""))
{
myConn.Open();
string str = "SELECT * FROM [Sheet1$]";
OleDbDataAdapter myCommand = new OleDbDataAdapter(str, myConn);
DataSet ds= new DataSet();
myCommand.Fill(ds);
myConn.Close();
}

a410787073 2010-10-20
  • 打赏
  • 举报
回复
你可能没看明白,
<freetextbox id="ftxt" ruant="ruant" buttonpath="../images/ftp/"></freetextbox>
怎么设置其中属性让点击上传图片的时候让他链接到我们自己指定的路径,,
吴青峰 2010-10-20
  • 打赏
  • 举报
回复
public void DisplayImages() {
string[] FilesArray = ReturnFilesArray();
string[] DirectoriesArray = ReturnDirectoriesArray();
string AppPath = HttpContext.Current.Request.PhysicalApplicationPath;
string AppUrl;

//Get the application's URL
if (Request.ApplicationPath == "/")
AppUrl = Request.ApplicationPath;
else
AppUrl = Request.ApplicationPath + "/";

GalleryPanel.Controls.Clear();
if ( (FilesArray == null || FilesArray.Length == 0) && (DirectoriesArray == null || DirectoriesArray.Length == 0) ) {
gallerymessage.Text = NoImagesMessage + ": " + RootImagesFolder.Value;
} else {
string ImageFileName = "";
string ImageFileLocation = "";

int thumbWidth = 94;
int thumbHeight = 94;

if (CurrentImagesFolder.Value != RootImagesFolder.Value) {

System.Web.UI.HtmlControls.HtmlImage myHtmlImage = new System.Web.UI.HtmlControls.HtmlImage();
myHtmlImage.Src = AppUrl + "images/ftb/folder.up.gif";
myHtmlImage.Attributes["unselectable"]="on";
myHtmlImage.Attributes["align"]="absmiddle";
myHtmlImage.Attributes["vspace"]="36";

string ParentFolder = CurrentImagesFolder.Value.Substring(0,CurrentImagesFolder.Value.LastIndexOf("\\"));

System.Web.UI.WebControls.Panel myImageHolder = new System.Web.UI.WebControls.Panel();
myImageHolder.CssClass = "imageholder";
myImageHolder.Attributes["unselectable"]="on";
myImageHolder.Attributes["onclick"]="divClick(this,'');";
myImageHolder.Attributes["ondblclick"]="gotoFolder('" + RootImagesFolder.Value + "','" + ParentFolder.Replace("\\","\\\\") + "');";
myImageHolder.Controls.Add(myHtmlImage);

System.Web.UI.WebControls.Panel myMainHolder = new System.Web.UI.WebControls.Panel();
myMainHolder.CssClass = "imagespacer";
myMainHolder.Controls.Add(myImageHolder);

System.Web.UI.WebControls.Panel myTitleHolder = new System.Web.UI.WebControls.Panel();
myTitleHolder.CssClass = "titleHolder";
myTitleHolder.Controls.Add(new LiteralControl("向上"));
myMainHolder.Controls.Add(myTitleHolder);

GalleryPanel.Controls.Add(myMainHolder);

}

foreach (string _Directory in DirectoriesArray) {

try {
string DirectoryName = _Directory.ToString();


System.Web.UI.HtmlControls.HtmlImage myHtmlImage = new System.Web.UI.HtmlControls.HtmlImage();
myHtmlImage.Src = AppUrl + "images/ftb/folder.big.gif";
myHtmlImage.Attributes["unselectable"]="on";
myHtmlImage.Attributes["align"]="absmiddle";
myHtmlImage.Attributes["vspace"]="29";

System.Web.UI.WebControls.Panel myImageHolder = new System.Web.UI.WebControls.Panel();
myImageHolder.CssClass = "imageholder";
myImageHolder.Attributes["unselectable"]="on";
myImageHolder.Attributes["onclick"]="divClick(this);";
myImageHolder.Attributes["ondblclick"]="gotoFolder('" + RootImagesFolder.Value + "','" + DirectoryName.Replace(AppPath,"").Replace("\\","\\\\") + "');";
myImageHolder.Controls.Add(myHtmlImage);

System.Web.UI.WebControls.Panel myMainHolder = new System.Web.UI.WebControls.Panel();
myMainHolder.CssClass = "imagespacer";
myMainHolder.Controls.Add(myImageHolder);

System.Web.UI.WebControls.Panel myTitleHolder = new System.Web.UI.WebControls.Panel();
myTitleHolder.CssClass = "titleHolder";
myTitleHolder.Controls.Add(new LiteralControl(DirectoryName.Replace(AppPath + CurrentImagesFolder.Value + "\\","")));
myMainHolder.Controls.Add(myTitleHolder);

GalleryPanel.Controls.Add(myMainHolder);
} catch {
// nothing for error
}
}

foreach (string ImageFile in FilesArray) {

try {

ImageFileName = ImageFile.ToString();
ImageFileName = ImageFileName.Substring(ImageFileName.LastIndexOf("\\")+1);
ImageFileLocation = AppUrl;
ImageFileLocation = ImageFileLocation.Substring(ImageFileLocation.LastIndexOf("\\")+1);
//galleryfilelocation += "/";
ImageFileLocation += CurrentImagesFolder.Value;
ImageFileLocation += "/";
ImageFileLocation += ImageFileName;
System.Web.UI.HtmlControls.HtmlImage myHtmlImage = new System.Web.UI.HtmlControls.HtmlImage();
myHtmlImage.Src = ImageFileLocation;
System.Drawing.Image myImage = System.Drawing.Image.FromFile(ImageFile.ToString());
myHtmlImage.Attributes["unselectable"]="on";
//myHtmlImage.border=0;

// landscape image
if (myImage.Width > myImage.Height) {
if (myImage.Width > thumbWidth) {
myHtmlImage.Width = thumbWidth;
myHtmlImage.Height = Convert.ToInt32(myImage.Height * thumbWidth/myImage.Width);
} else {
myHtmlImage.Width = myImage.Width;
myHtmlImage.Height = myImage.Height;
}
// portrait image
} else {
if (myImage.Height > thumbHeight) {
myHtmlImage.Height = thumbHeight;
myHtmlImage.Width = Convert.ToInt32(myImage.Width * thumbHeight/myImage.Height);
} else {
myHtmlImage.Width = myImage.Width;
myHtmlImage.Height = myImage.Height;
}
}

if (myHtmlImage.Height < thumbHeight) {
myHtmlImage.Attributes["vspace"] = Convert.ToInt32((thumbHeight/2)-(myHtmlImage.Height/2)).ToString();
}


System.Web.UI.WebControls.Panel myImageHolder = new System.Web.UI.WebControls.Panel();
myImageHolder.CssClass = "imageholder";
myImageHolder.Attributes["onclick"]="divClick(this,'" + ImageFileName + "');";
myImageHolder.Attributes["ondblclick"]="returnImage('" + ImageFileLocation.Replace("\\","/") + "','" + myImage.Width.ToString() + "','" + myImage.Height.ToString() + "');";
myImageHolder.Controls.Add(myHtmlImage);


System.Web.UI.WebControls.Panel myMainHolder = new System.Web.UI.WebControls.Panel();
myMainHolder.CssClass = "imagespacer";
myMainHolder.Controls.Add(myImageHolder);

System.Web.UI.WebControls.Panel myTitleHolder = new System.Web.UI.WebControls.Panel();
myTitleHolder.CssClass = "titleHolder";
myTitleHolder.Controls.Add(new LiteralControl(ImageFileName + " <br />" + myImage.Width.ToString() + "x" + myImage.Height.ToString()));
myMainHolder.Controls.Add(myTitleHolder);

//GalleryPanel.Controls.Add(myImage);
GalleryPanel.Controls.Add(myMainHolder);

myImage.Dispose();
} catch {

}
}
gallerymessage.Text = "";
}
}

自己看。

62,074

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧