meltingice/js-twitpic — Issue #4: files without extensions
Author: icodeforlove
Created: 2011-12-15 05:44:59+00:00
State: open

I used this twitpic library previously and it worked like a charm, but due to some changes we needed to read from images without file extensions. Currently the way that mime is working it defaults to **application/octet-stream**, which causes twitpic to respond with

```
{"errors":[{"code":400,"message":"Bad Request. Media not included in POST payload."}]}
```

It would be pretty awesome if you added a way to manually override/provide the mimetype like this:

```javascript
twitpic.upload({path: "/tmp/887060a0b1cf04a2ea96e91a04c320cc", mimeType: 'image/gif'}, function (data) {
});
```

i got it working by just adding the following:

```javascript
mimeType = opts.mimeType || mime.lookup(opts.path);
```