我想要实现的效果为:点击“浏览”,可以选择多张图片,然后,再通过点击“上传”按钮再提交到数据库。就是 “批量上传”功能。请行家指点指点!
解决方案 »
- 【求助】web程序开发中动态多行录入以及把录入数据放进数据库的问题。
- FreeTextBox 自动换行
- Repeater怎么用
- 关于Formview的问题
- 如果用javascript改变了listbox的options,怎样在server得到这些改变?谢谢
- ASP.NET写的网站,需要上传哪些文件?access数据库连接字符串怎么写?急!!!
- 怎样才能从ASP.Net运行exe程序!!!?请楼主帮忙了!!!
- 简单问题,有心者进!
- 无刷新两级联动,当点击下拉框时如何触发事件...
- 如何在客户端将datagrid中的数据导入到客户机中,并且以excel的形式保存?
- jquery updatepanel 好像不兼容
- IE6使用Uploadify老是会报错。
{
var strFile="<input name=\"upload_A\" type='file' class='inputText' style='WIDTH:350px;'/><br/>";
document.getElementById("td_uploadFile").insertAdjacentHTML("beforeEnd",strFile);
}
<td id="td_uploadFile" align="center">
<input id="upload_A" name="upload_A" type="file" class="inputText"
style="width: 350px; display:none;" runat="server" />
</td>HttpFileCollection Files = HttpContext.Current.Request.Files;
for (int i = 0; i < Files.Count; i++)
{
}
http://topic.csdn.net/u/20100807/11/4801f6d9-4fd0-4b87-84b4-f28f9ae474d7.html
swfupload
http://www.swfupload.org/
{
try
{
fileup(FileUpload6, TextBox1);
fileup(FileUpload5, TextBox2);
fileup(FileUpload4, TextBox3);
fileup(FileUpload3, TextBox4);
fileup(FileUpload2, TextBox5);
}
catch (Exception ex)
{
throw ex;
}
}
public bool fileup(FileUpload f,TextBox tex)
{
Boolean bo = false;
string magazine_id = DropDownList1.SelectedItem.Value;
string image_re = tex.Text;
string time = System.DateTime.Now.ToString();
if (f.HasFile)
{
String name = f.PostedFile.FileName;
FileInfo file = new FileInfo(name);
//string fileName = file.Name;
string fileName = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + file.Name; ; string webFilepath = Server.MapPath("userfiles/IMAGE/myphoto/" + magazine_id + fileName);
string fileContentType = f.PostedFile.ContentType; if (fileContentType == "image/gif" || fileContentType == "image/pjpeg" || fileContentType == "image/jpg")
{
if (!File.Exists(webFilepath))
{
try
{
f.SaveAs(webFilepath); this.AddImageWater(webFilepath); string url = "~/userfiles/IMAGE/myphoto/" + magazine_id + fileName;
string sql2 = "insert into image(image_url,image_re,magazine_id)values('" + url + "','" + image_re + "','" + magazine_id + "')";
Datacommand.datacom().exqut(sql2);
Response.Write("<script language = javascript>alert('提交成功!');</script>");
bo = true;
}
catch (Exception ex)
{
Label9.Visible = true;
Label9.Text = "图片上传失败,失败原因:" + ex.Message;
}
}
else
{
Label9.Visible = true;
Label9.Text = "图片已存在,请重命名后上传"; }
}
else
{
Label9.Visible = true;
Label9.Text = "为节省服务器空间,提高网站速度,请上传*.jpg、*.gif、*pjpeg类型图片";
}
}
return bo;
}