I trying to implement the demo that is on the www.dropzonejs.com site but i am having trouble doing what it is supposed to. I will be connecting it to a database so i can send a copy of the uploaded file info to the database. Has anyone done a clear tutorial with this in asp.net c#? How can i control what i have so once a file has been dropped in the area i will fire up the method for database connections?
html:
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<script src="~/Scripts/dropzone.js"></script>
<link href="~/Content/dropzone.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form class="dropzone dz-clickable">
<div class="dz-default dz-message">
<span>DRAG & DROP FILES HERE</span>
</div>
</form>
</body>
</html>
Tried this from another stackoverflow post but not sure it is doing anything it is not passing into the foreach loop:
protected void Page_Load(object sender, EventArgs e)
{
foreach (string s in Request.Files)
{
HttpPostedFile file = Request.Files[s];
int filesSizeInBytes = file.ContentLength;
string fileName = Request.Headers["X-File-Name"];
string fileExtension = "";
if (!string.IsNullOrEmpty(fileName))
fileExtension = Path.GetExtension(fileName);
string savedFileName = Path.Combine(@"C:\temp\", Guid.NewGuid().ToString() + fileExtension);
file.SaveAs(savedFileName);
}
}