Feedback on NI Community

取消
显示结果 
搜索替代 
您的意思是: 

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?

0 项奖励
1 条消息(共 10 条)
7,082 次查看

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



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 项奖励
2 条消息(共 10 条)
7,078 次查看

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 项奖励
3 条消息(共 10 条)
7,058 次查看

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.

0 项奖励
4 条消息(共 10 条)
7,049 次查看
0 项奖励
5 条消息(共 10 条)
7,044 次查看

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 项奖励
6 条消息(共 10 条)
7,039 次查看

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.

 

0 项奖励
7 条消息(共 10 条)
7,033 次查看

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,

~~~~~~~~~
8 条消息(共 10 条)
7,014 次查看

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

 

Thanks,

~~~~~~~~~
0 项奖励
9 条消息(共 10 条)
6,535 次查看

Test of zip file.

0 项奖励
10 条消息(共 10 条)
5,141 次查看