Dropzone upload Max file size

Hi,
I use Dropzone to upload the files to the site.
http://www.dropzonejs.com/#events

  
			<form id="upload" method="post" action="Docs.aspx" enctype="multipart/form-data">
			<div id="drop">
				Drag & Drop Here

				<a>Browse</a>
				<input type="file" name="upl" multiple />
			</div>

			<ul>
				<!-- The file uploads will be shown here -->
			</ul>

		</form>

Open in new window

this is the code behind

    protected void Page_Load(object sender, EventArgs e)
    {
        



        bool exists = System.IO.Directory.Exists(Server.MapPath("~/DocStorage/File-" + Session["sCMID"]));
        if (!exists)
            System.IO.Directory.CreateDirectory(Server.MapPath("~/DocStorage/File-" + Session["sCMID"]));

        DirectoryInfo flDis = new DirectoryInfo(Server.MapPath("~/DocStorage/File-" + Session["sCMID"]));

        foreach (string s in Request.Files)
        {
            HttpPostedFile file = Request.Files[s];
            int fileSizeInBytes = file.ContentLength;
            string fileName = file.FileName;
            string fileExtension = "";


            if (!string.IsNullOrEmpty(fileName))
                fileExtension = Path.GetExtension(fileName);
            string savedFileName = Guid.NewGuid().ToString() + fileExtension;
            //string savedFileName = fileName;

            string filename = Server.MapPath("~/DocStorage/File-" + Session["sCMID"] + "/" ) + savedFileName;
            

            file.SaveAs(filename);
            
        }



        FileInfo[] filesInDir = flDis.GetFiles("*.*");

        List<ListItem> files = new List<ListItem>();
        foreach (FileInfo foundFile in filesInDir)
        {
           files.Add(new ListItem(Path.GetFileName(foundFile.FullName), foundFile.FullName));
        }
        GridView1.DataSource = files;
         GridView1.DataBind();

        

    }

Open in new window


Everything works fine, but is there a way to set the max file size and file type? thanks
mcrmgAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

leakim971PluritechnicianCommented:
as you can see here : http://www.dropzonejs.com/#configuration
we have the parameter maxFilesize

Dropzone.options.upload = {
      maxFilesize: 2, // 2 MB
0
mcrmgAuthor Commented:
That is what puzzles me. Where do I put it? thanks
0
leakim971PluritechnicianCommented:
That is what puzzles me. Where do I put it? thanks

You just need to read the documentation :
The typical way of using dropzone is by creating a form element with the class dropzone:
<script src="./path/to/dropzone.js"></script>
<body>
<form id="upload" method="post" action="Docs.aspx" enctype="multipart/form-data" class="dropzone">
	<div id="drop">
		Drag & Drop Here

		<a>Browse</a>
		<input type="file" name="upl" multiple />
	</div>

	<ul>
	<!-- The file uploads will be shown here -->
	</ul>
</form>
<script>
Dropzone.options.upload = {
      maxFilesize: 2, // 2 MB       
}
</script>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
leakim971PluritechnicianCommented:
Just made a test to confirm it work :
maxfilesize
0
mcrmgAuthor Commented:
thank you very much
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.