JavaScript Error: Unable to get property msie of undefined or null reference

Last Reply 3 months ago By simflex

Posted 3 months ago

Greetings again experts.

I found this great article from the aspsnippets.com.

Upload and attach multiple files as attachments to email in ASP.Net

That forum and this one have always been a great resource for me.

The most intriguing part is that the Attach Files box is not even showing.

The only thing that shows on that page is the is the browse button and the input box where the file you select shows.

http://debestqualityprivatehomecare.com/images/browse.png

I am using framework 4.0 and above and I noticed this was written for framework 3.5

However, I found another great article on aspsnippets that allows user to click Add to add files.

Uploading Multiple Files using JavaScript Dynamic FileUpload Controls in ASP.Net

It also allows you to remove files.

You can attach as many as possible and this one WORKS.

However when I click Submit (on btnSave_Click). it is not saving any file on Uploads folder.

You are viewing reply posted by: simflex 3 months ago.
Posted 3 months ago

Thank you so much pandeyism for your help.

I finally figured out the problem.

It turns out that property msie was no longer supported from jQuery 1.9 library and above.

So, after removing pretty much all my css links and nothing still worked, I checked developer tools by clicking f12 and discovered there was an error:

Unable to get property 'msie' of undefined or null reference

I added the below code and now the attach button is showing up.

Again, thanks for all your help.

<script type="text/javascript">
    jQuery.browser = {};
    (function () {
        jQuery.browser.msie = false;
        jQuery.browser.version = 0;
        if (navigator.userAgent.match(/MSIE ([0-9]+)\./)) {
            jQuery.browser.msie = true;
            jQuery.browser.version = RegExp.$1;
        }
    })();
</script>