coastman14
asked on
c# syntax Loop through request.files Item...
foreach (string item in Request.Files)
{
if (System.Web.UI.WebControls .[item].Po stedFile.C ontentLeng th <= 250000)
The type or namespace name 'item' does not exist in the class or namespace 'System.Web.UI.WebControls ' (are you missing an assembly reference?)
I am creating the Files in a placeholder and they do not have static names, what syntax do i use, for the simple example above...
Andrew
{
if (System.Web.UI.WebControls
The type or namespace name 'item' does not exist in the class or namespace 'System.Web.UI.WebControls
I am creating the Files in a placeholder and they do not have static names, what syntax do i use, for the simple example above...
Andrew
maybe you can post where item is declared
Hi, you have a period before the indexer, try changing your condition to:
if (System.Web.UI.WebControls [item].Pos tedFile.Co ntentLengt h <= 250000)
if (System.Web.UI.WebControls
Sorry ignore my previous post, it wouldn't correct the issue
ASKER
private void cmdUpload_ServerClick(obje ct sender, System.EventArgs e)
{
string filenumber="";
string formvalue="";
string mysql=" update lee2 set ";
//foreach ( DataRow row in table.Rows )
foreach (string item in Request.Files)
{
//Go and get the files that are not null
if (( Request.Files[item] != null) && (Request.Files[item].Conte ntLength>0 ))
{
string sFileName = System.IO.Path.GetFileName (Request.F iles[item] .FileName) ;
//Response.Write (sFileName);
filenumber=Regex.Replace(i tem.ToStri ng(),"Uplo ad","");
//Response.Write (item.ToString());
formvalue=(Request.Form["t extbox" + filenumber]);
if (formvalue!="" && formvalue!=" " && formvalue!=null && Request.Form["textbox" + filenumber]!="" && System.Web.UI.WebControls. [item].Pos tedFile.Co ntentLengt h <= 250000)
{
string filenumber="";
string formvalue="";
string mysql=" update lee2 set ";
//foreach ( DataRow row in table.Rows )
foreach (string item in Request.Files)
{
//Go and get the files that are not null
if (( Request.Files[item] != null) && (Request.Files[item].Conte
{
string sFileName = System.IO.Path.GetFileName
//Response.Write (sFileName);
filenumber=Regex.Replace(i
//Response.Write (item.ToString());
formvalue=(Request.Form["t
if (formvalue!="" && formvalue!=" " && formvalue!=null && Request.Form["textbox" + filenumber]!="" && System.Web.UI.WebControls.
In fact Zephyr's comment is interesting, there is a strage dot after WebControls...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.