Click here to Skip to main content
15,885,435 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I upload doc,xls files but i dont understand how upload html files. This code upload file but dont preview file. Its say- "We apologize Preview not available". Whats mime type i must set ?

C#
 if (extension == ".htm" || extension == ".html")
                    {

File body = new File();
body.Title = Path.GetFileNameWithoutExtension(item); 
//body.Description = "A test document";
body.MimeType = "text/HTML";
byte[] byteArray = System.IO.File.ReadAllBytes(item);
System.IO.MemoryStream stream = new System.IO.MemoryStream(byteArray);
FilesResource.InsertMediaUpload request = service.Files.Insert(body, stream,
"application/vnd.google-apps.file");
                        request.Convert = true;
Posted
Comments
Kornfeld Eliyahu Peter 7-Oct-14 13:47pm    
Why not ask Google?
Sergey Alexandrovich Kryukov 7-Oct-14 14:52pm    
The content type should be "text/html".
—SA

1 solution

Any questions on content-type? They all are supported and maintained by IANA:
http://www.iana.org/assignments/media-types/media-types.xhtml[^].

See also:
http://en.wikipedia.org/wiki/Internet_media_type[^],
http://en.wikipedia.org/wiki/IANA[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900