Feedback on NI Community

cancel
Showing results for 
Search instead for 
Did you mean: 

can't upload .cs files without giving them a .txt extension first

I was helping a user with some .NET-to-C API questions, and I tried to upload a C# source file, and got this error.

 

Correct the highlighted errors and try again.

The attachment's ForumExample.cs content type (text/plain) does not match its file extension and has been removed.

 

This can be worked around by renaming the file with a .txt extension, but this is quite an annoyance. Could one of the admins be so kind as to teach the forum software that .cs files are plaintext?

——
Brandon Streiff
ni.com/compactdaq · ni.com/daq
0 Kudos
Message 1 of 10
(6,004 Views)

Another option is to just zip the file(s).  But join the club.  I have not been able to upload VIs for awhile now:  Problems uploading a ZIP file


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 10
(6,000 Views)

Hi Brandon,

 

I am unable to reproduce your issue. Is this happening to you every time you attempt to attach the .cs file? Does it happen if you attach the file to a post in this topic?

 

Thanks,

~~~~~~~~~
0 Kudos
Message 3 of 10
(5,980 Views)

Yep, happens when trying to attach it here too.

 

This is with Chrome 43.0.2357.130 on Windows.

 

If I throw Wireshark at it, I do in fact see a multipart form segment with Content-Disposition: form-data; name="upload"; filename="ForumExample.cs" with Content-Type: text/plain when I try to post.

——
Brandon Streiff
ni.com/compactdaq · ni.com/daq
0 Kudos
Message 4 of 10
(5,971 Views)

Testing

——
Brandon Streiff
ni.com/compactdaq · ni.com/daq
0 Kudos
Message 5 of 10
(5,966 Views)

This issue seems to be caused by the specific environment Brandon is using. I will raise a case with Lithium to see if there's anything that can be done.

 

Thanks,

~~~~~~~~~
0 Kudos
Message 6 of 10
(5,961 Views)

A few more details for anyone else running to this:

 

When you install Visual Studio, it adds a registry key that gives the MIME type for .cs files (Computer\HKEY_CLASSES_ROOT\.cs\Content Type, with value "text/plain").

Chrome picks that up and sends that MIME type along with your attachment. (Verified by modify the registry key to "text/kindaplain" and seeing that reflected in the error message).

The forum doesn't believe that "text/plain" is valid for .cs files (I'm not sure what it is expecting?), so you get the error.

 

——
Brandon Streiff
ni.com/compactdaq · ni.com/daq
0 Kudos
Message 7 of 10
(5,955 Views)

Lithium has reproduced this issue on a machine which has Visual Studio installed. They are working to further triage this bug, so in the meantime please use the workarounds mentioned in this thread.

 

Thanks,

~~~~~~~~~
Message 8 of 10
(5,936 Views)

This issue should be resolved now. Please let us know if this is not the case.

 

Thanks,

~~~~~~~~~
0 Kudos
Message 9 of 10
(5,457 Views)

Test of zip file.

0 Kudos
Message 10 of 10
(4,063 Views)