Forum  Commercial Foru...  Commercial Foru...  OpenFileDialog - MaxFileSize issue
Previous Previous
 
Next Next
New Post 8/4/2009 3:07 PM
  globalservices
150 posts
5th Level Poster


OpenFileDialog - MaxFileSize issue 

Hello, there seems to be an issue with the Open File dialog.

I set the MaxFileSize to something really big (1200000) and then call ShowDialog().  Then, in the FileOk event handler, the File property is sometimes null.  I think it has to do with the size of the file being uploaded.  Over 4k perhaps?

This code should explain it.

 

private void button1_Click(object sender, EventArgs e)
{
openFileDialog1.MaxFileSize = 1200000;
openFileDialog1.ShowDialog();
}
private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
{
if (openFileDialog1.File == null)
MessageBox.Show("openFileDialog1.File is null, was the file over 4K???");
else
MessageBox.Show(String.Format("File successfully uploaded to {0}", openFileDialog1.FileName));
}

thanks,
Andrew

 

 
New Post 8/4/2009 4:36 PM
  palli
14313 posts
1st Level Poster




Re: OpenFileDialog - MaxFileSize issue 

Hi Andrew,

The maximum filesize is affected by both openFileDialog.MaxFileSize and this ASP.NET setting (which defaults to max 4Mb):

<system.web>
  <httpRuntime  maxRequestLength="102400" executionTimeout="360"/>
</system.web>

See more information here as an example.

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
New Post 8/5/2009 6:19 AM
  globalservices
150 posts
5th Level Poster


Re: OpenFileDialog - MaxFileSize issue 

thanks Palli, that was it.

 
New Post 8/5/2009 11:54 AM
  palli
14313 posts
1st Level Poster




Re: OpenFileDialog - MaxFileSize issue 

Hi Andrew,

Glad it did and thanks for confirming.

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
Previous Previous
 
Next Next
  Forum  Commercial Foru...  Commercial Foru...  OpenFileDialog - MaxFileSize issue
.NET HTML5 Web, Cloud and Mobile application delivery | Sitemap | Terms of Use | Privacy Statement | Copyright © 2005-2012 Visual WebGui®       Visual WebGui weblog on ASP.NET Gizmox Blog Visual WebGui Group on LinkedIn Visual WebGui updates on Twitter Visual WebGui Page on Facebook Visual WebGui YouTube Channel Visual WebGui Platform News RSS