mime-types

How to programmatically share multiple files of different MIME types within the same Android intent?

这一生的挚爱 提交于 2021-02-20 03:51:43
问题 I am working on an Android application that is already successfully sharing a generated PDF file via Bluetooth using the following method: public static void sharePdfFile(Context ctx, String pathAndFile) { try { Intent share = new Intent(Intent.ACTION_SEND); share.setPackage("com.android.bluetooth"); share.setType("application/pdf"); share.putExtra(Intent.EXTRA_STREAM, Uri.parse(pathAndFile)); share.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); ctx.startActivity(share); } catch (Exception e) {

How to programmatically share multiple files of different MIME types within the same Android intent?

匆匆过客 提交于 2021-02-20 03:51:22
问题 I am working on an Android application that is already successfully sharing a generated PDF file via Bluetooth using the following method: public static void sharePdfFile(Context ctx, String pathAndFile) { try { Intent share = new Intent(Intent.ACTION_SEND); share.setPackage("com.android.bluetooth"); share.setType("application/pdf"); share.putExtra(Intent.EXTRA_STREAM, Uri.parse(pathAndFile)); share.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); ctx.startActivity(share); } catch (Exception e) {

Apps Script Drive App Service - Create a file of Google Type - Mime Type

蹲街弑〆低调 提交于 2021-02-19 07:57:17
问题 I'm using the .createFile method of the DriveApp Folder class. This is the syntax: createFile(name, content, mimeType) The documentation is here: createFile Google DriveApp Service The example shows a mimeType setting of MimeType.HTML. // Create an HTML file with the content "Hello, world!" DriveApp.createFile('New HTML File', '<b>Hello, world!</b>', MimeType.HTML); I can type in MimeType. and get a list of MimeTypes, one of them being GOOGLE_DOCS . So I entered MimeType.GOOGLE_DOCS . But I'm

Proper mime-type for patch files

不想你离开。 提交于 2021-02-18 10:44:06
问题 Anybody know what the "proper" mime-type for patch files would be? I have been using application/octet-stream because I don't see anything better at iana.org. Is application/octet-stream correct, or is there something else that fits better? Why is there no application/patch type? Obviously, one possible answer is text/plain , but I have seen many patch files which include data which is not purely text. Is text/plain the best choice if you know for a fact all content is text, or is it better

Resource was blocked due to MIME type mismatch using pug and node

筅森魡賤 提交于 2021-02-13 05:44:10
问题 I'm trying to render a view with an id in the url: router.get('/employee', authController.protect, viewsController.getOverviewEmployee); router.get('/employee/:id', authController.protect, viewsController.getOneEmployee); The /employee works fine, but when I get to the /employee/:id page the css and scripts won't load and the console shows me this error: The resource from “http://127.0.0.1:3000/employee/lib/bootstrap/css/bootstrapmin.css” was blocked due to MIME type (“application/json”)

Retrieving Images stored in Mongodb with Nodejs

雨燕双飞 提交于 2021-02-11 11:59:25
问题 I have small thumbnails stored in a MongoDB collection. While I can extract them with a .findOne() I can not serve them back over an ExpressJS route correctly. I am not storing thumbs on disk as the heroku environment does not guarantee persisted storage. I am not using GridFS as these are thumbs < 16MB. Inserting a a new document into the collection goes something like this: MongoClient.connect(url, function(err, db){ var newImg = fs.readFileSync(req.file.path); var encImg = newImg.toString(

Retrieving Images stored in Mongodb with Nodejs

十年热恋 提交于 2021-02-11 11:52:45
问题 I have small thumbnails stored in a MongoDB collection. While I can extract them with a .findOne() I can not serve them back over an ExpressJS route correctly. I am not storing thumbs on disk as the heroku environment does not guarantee persisted storage. I am not using GridFS as these are thumbs < 16MB. Inserting a a new document into the collection goes something like this: MongoClient.connect(url, function(err, db){ var newImg = fs.readFileSync(req.file.path); var encImg = newImg.toString(

Laravel 7 Incorrect MIME Type Detected

爷,独闯天下 提交于 2021-02-10 22:16:58
问题 Laravel 7 on PHP 7 is detecting incorrect MIME type of application/octet-stream for .ogg extension. Here is the applicable file request dump: Illuminate\Http\UploadedFile {#1274 ▼ -test: false -originalName: "03 - See You Tonite.ogg" -mimeType: "application/octet-stream" Anybody know of a workaround for this? 回答1: Check your mime type file first: return $request->file('field_name')->getMimeType(); Now you can add the following code in the boot method in AppServiceProvider: public function

Php include() proper Mime-types

╄→尐↘猪︶ㄣ 提交于 2021-02-10 15:56:43
问题 TLDR: I'm looking for a way to serve web resources (css, jpg, etc) from the filesystem that preserves mime-type. I am creating a php wrapper that validates a user from another domain (via a one time token), creates a session and then serves files, several websites in separate directories, inside of a otherwise in accesable directory to that user. I have, so far, used php to handle validation and mod_rewrite to redirect all requests for anything inside of the directory through the wrapper

Browser accepts “classic” js script-tag, but not ES6 modules — MIME error w/ Node http server

一个人想着一个人 提交于 2021-02-08 08:42:12
问题 I want to play with ES6 modules, so I decided on using Node as a simple web server to avoid all CORS related errors I first encountered when doing it locally. Now I get MIME type related errors in the browser which I can't quite grasp. Here is my server.js file: const http = require('http'), url = require('url'), fs = require('fs'); http.createServer((req, res) => { const q = url.parse(req.url, true), filename = "." + q.pathname; fs.readFile(filename, (err, data) => { if (err) { res.writeHead