The text of this article is not in this database — only its details are. Read it on the old site: How to: Upload a File in ASP.NET
21 Comments
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment.
The text of this article is not in this database — only its details are. Read it on the old site: How to: Upload a File in ASP.NET
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment.
Deven ThakurPosted Apr 2, 2011, 5:07 AM
after saving the file .. we saved its address as a database field.... ok but how we will access that file at the front with the use of that address stored in database plz plz solve my query....
bhargav reddyPosted Aug 17, 2010, 2:08 AM
Hi, This very nice article.
Ruan jingbiaoPosted Jul 21, 2010, 3:55 AM
there some codes: string fileName =pdf.FileName;//????? if (fileName != null)//???? { string postfix = System.IO.Path.GetExtension(fileName).ToString().ToLower();//????? if (postfix == ".pdf" || postfix == ".rar" || postfix == ".doc" || postfix == ".jpg" || postfix == ".txt" || postfix == ".gif" || postfix == ".bmp" || postfix == ".xls") { double size = pdf.FileContent.Length / 1024; if (size <= 5120) { Regex reg = new Regex(@"\.\w*?$"); string path = ""; string reFileName = reg.Replace(fileName, "") + DateTime.Now.ToStr("yyyyMMdd") + DateTime.Now.Ticks + postfix; string companyName = TSQL.ExecDr(this.getSQL("selectcompanybyId"), Session["CompanyID"].ToInt32())["com_name"].ToStr();// TSQL.ExecuteScalar(this.getSQL("selectcompanynamebyId"), Session["CompanyID"].ToInt32()).ToStr(); string foo = Server.MapPath("..//Js"); string folder = Server.MapPath("..//PdfFile") + "\\" + companyName; if (Directory.Exists(folder)) path = folder + "\\" + reFileName.ToStr(); else { Directory.CreateDirectory(folder); path = folder + "\\" + reFileName.ToStr(); } pdf.SaveAs(path); files = "../PdfFile/" + companyName + "/" + reFileName; if (this.HiddenField1.Value == "") TSQL.ExecuteNonQuery(this.getSQL("insertintockmt"), no.Text.ToStr(), name.Text.ToStr(), style.Text.ToStr(), date.Text.ToDateTime(), price.Text.ToDecimal(), power.Text.ToDecimal(), heigth.Text.ToDecimal(), width.Text.ToDecimal(), length.Text.ToDecimal(), weigth.Text.ToDecimal(), provider.Text.ToStr(), works.Text.ToStr(), Session["CompanyID"].ToInt32(), files); else { if (pdfs.Value == "") TSQL.ExecuteNonQuery(this.getSQL("updateckmt"), no.Text.ToStr(), name.Text.ToStr(), style.Text.ToStr(), date.Text.ToDateTime(), price.Text.ToDecimal(), power.Text.ToDecimal(), heigth.Text.ToDecimal(), width.Text.ToDecimal(), length.Text.ToDecimal(), weigth.Text.ToDecimal(), provider.Text.ToStr(), works.Text.ToStr(), files, this.HiddenField1.Value.ToInt32(), Session["CompanyID"].ToInt32()); else TSQL.ExecuteNonQuery(this.getSQL("updateckmt"), no.Text.ToStr(), name.Text.ToStr(), style.Text.ToStr(), date.Text.ToDateTime(), price.Text.ToDecimal(), power.Text.ToDecimal(), heigth.Text.ToDecimal(), width.Text.ToDecimal(), length.Text.ToDecimal(), weigth.Text.ToDecimal(), provider.Text.ToStr(), works.Text.ToStr(), pdfs.Value.ToStr(), this.HiddenField1.Value.ToInt32(), Session["CompanyID"].ToInt32()); this.HiddenField1.Value = ""; } } } else this.ScriptManager1.alert("????pdf??,doc??,xls??,txt??,jpg??,gif??,bmp??,rar????"); i use fileupload control , but can't upload pdf files why...? if you can help me , please send email for [email protected] thinks...
Farid EkhteraeiPosted Jun 18, 2010, 3:56 AM
Thank you for your useful code. Works great.
ruby guptaPosted Apr 24, 2010, 2:09 AM
hi....could you help me to store files in database(sql server2005) using file upload tool.
sarav kannaneditedPosted Oct 10, 2009, 1:01 AMEdited Oct 10, 2009, 1:05 AM
http://www.onlineatoz.net/onlineatoznet/forum/post/ToolBox-Standard-Control-FileUpload.aspx
Ram Narain prajapatiPosted Apr 14, 2009, 5:17 AM
nice source for file upload congrates for this
zenny kkPosted Apr 8, 2009, 2:45 AM
i am able to upload the file.. now i hav to modify the file and save again in the oracle databse.. modify is not happening.... can any1 help?
mohammed subaaPosted Apr 6, 2009, 4:27 PM
thanks more
zenny kkPosted Apr 6, 2009, 8:06 AM
hiii the code u hav posted is of real good help.... im a student in a college and trying to learn asp.net. there is nobody to help. could i get ur help or any contact plz plz plz plz plz plz plz...
Ashish RPosted Jan 3, 2009, 1:20 PM
how to assign a text in Text Box of UpLoadFile Control in ASP.Net
reer dgdgdPosted Dec 30, 2008, 5:55 AM
another example here : http://www.mo8.co.il/WebControls.aspx
satya anand andraPosted Dec 17, 2007, 3:51 AM
your program is working great..... could you plz tell me.. How to save the file as it is in the same format as in the previous....
Etienne PennekanPosted Nov 23, 2007, 3:33 AM
Hi Great......it works but i cant upload a LARGE file.... Why is that? Etienne
Michael SaulPosted Oct 17, 2007, 8:35 AM
How could I maintain the original file's timestamps, etc.? Using File.Copy() method works locally, but I need that on the web server...
P KarthickPosted Aug 3, 2007, 2:55 AM
Hi Rahul, This is nice one keep upload some more applications Cheers, Karthick