mbart
asked on
How do I filter for Docx files for upload
I have an uploader control and I filter for mime types using below statement
problem is when I try to upload docx files. Returns invaliid file type.
problem is when I try to upload docx files. Returns invaliid file type.
if (StatementUpload.PostedFile.ContentType.Equals("application/msword") || StatementUpload.PostedFile.ContentType.Equals("application/pdf") || StatementUpload.PostedFile.ContentType.Equals("text/plain"))
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
When I used the mime type listed in your reference I get the following error:
Database Error Updating memberString or binary data would be truncated. The statement has been terminated.
File type on the database is set to image and the file I attempted to upload is a rather small file 68KB
Database Error Updating memberString or binary data would be truncated. The statement has been terminated.
File type on the database is set to image and the file I attempted to upload is a rather small file 68KB
ASKER
Tried changing the datatype on the db server to varbinary(MAX) and got the same error.
I didnt suggest to compress it, I mean docx files are zipped xml, and should seem like "x-zip-compressed" for the server.
Did you try to add "x-zip-compressed" to the content-type accept list ? If yes, what did happen ?
Did you try to add "x-zip-compressed" to the content-type accept list ? If yes, what did happen ?
ASKER
I will give it a try. Standby
ASKER
I tried it as
EndorsementUpload.PostedFi le.Content Type.Equal s("x-zip-c ompressed" ) and got invalid file type error.
EndorsementUpload.PostedFi
did you try thi one ? :
"application/vnd.openxmlfo rmats-offi cedocument .wordproce ssingml.do cument"
"application/vnd.openxmlfo
ASKER
As stated earlier, tried that already with the following error.
Database Error Updating memberString or binary data would be truncated. The statement has been terminated.
Database Error Updating memberString or binary data would be truncated. The statement has been terminated.
What is the definition of this field in your database ? varchar ? ..
ASKER
image, also tried varbinary(MAX) but no joy
ASKER
Would it be possible to use the file extension instead? If so can you provide a sample of the script?
ASKER
Thanks for the patience! Found what was causing the error. Length of the MIME type field in the db was causing the issue.
ASKER