ABLE Software
Thursday, August 5, 2010
LINQ to SQL
Thursday, July 29, 2010
Fun stuff with JQuery
Tuesday, July 27, 2010
'Steam'lining the upload
HttpPost, ActionName("AddProjectPlan")] //don't really understand this?
public void Add()
{
foreach (string file in Request.Files) //only posting one element from the form, but this would work for many
{
HttpPostedFileBase postedFile = Request.Files[file] as HttpPostedFileBase;
if (postedFile.ContentLength > 0) //if file not empty
{
//create an XML object for loading in the project plan xml
XmlDocument xmlProjPlan = new XmlDocument();
try
{
xmlProjPlan.Load(postedFile.InputStream);
Response.Write("File " + postedFile.FileName + " successfully loaded
");
}
catch
{
Response.Write("File " + postedFile.FileName + " is not valid XML
");
}
//Response.Write(xmlProjPlan.InnerXml); //for debugging
}
else
{
// Let user know there was a problem
Response.Write("No file submitted or file zero length");
}
}
}
}
Monday, July 26, 2010
ASP.net MVC file upload
<form action="/Home/AddProjectPlan" method="post" enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<input type="submit" name="submit" value="Submit" />
</form>