I am trying to upload a JSON through Dropzone.
The MIME type for JSON through acceptedFiles doesn't seem to be recognised.
Already tried:
acceptedFiles: 'application/json'; and
acceptedFiles: '.json';
When using 'application/json', dropzone doesnt recognise json file types so I am unable to upload a file.
When using '.json', I am able to upload a file but it turns into 'application/octet-stream'.
What do i need to use to upload a JSON and it be an accepted file type?
I fixed this by updating Google Chrome.
Related
I am working with a react application where you can access google drive files using react-google-picker and I am using get api of google apis where you can pass "alt=media" as a URL parameter to get the file content. It's working as expected for text files but for PDF/Doc files, it returns metadata instead of actual content of file.
Is there any other way to get the content using google api's ??
this is the code for getting content of the file.
axios.get(`https://www.googleapis.com/drive/v2/files/${data.docs[0].id}?key=${developerKey}&alt=media`, {
headers: {
Authorization: Bearer ${this.state.token}
}
})
I want to implement following using fuelPHP.
http://ckeditor.com/tmp/4.5.0-beta/image-upload.html
Then, I added all plugins and can upload the images to my directory.
However, I do know the format of the response for client side of CKEditor and so CKEditor is not able to locate file path.
Dose anyone know the format of its response?
I return the json object like following.
json_encode(array('responseText'=>'ok','uploaded'=>1,'fileName'=>"/assets/img/upload/d2ceb4f415e252199483ee96f5ba361d.png"),true);
The response should be like following
{
"uploaded": 1,
"fileName": "foo.jpg",
"url": "/files/foo.jpg"
}
I am trying to make use of 'Export PDF' functionality for a KendoUI grid. The following is the code in my grid configuration:
pdf: {
allPages: true,
fileName: "feesandcosts.pdf",
proxyURL: "http://demos.telerik.com/kendo-ui/service/export"
},
When I click the 'Export PDF' button the grid grays and disables out. When I try to test the URL by navigating to it directly in the web browser it seems to be a broken hyperlink.
Can some one help guide me?
This is the description of the proxyURL from API reference. In summary is an optional setting for browsers that dont support local save of files and if you use it you should implement the functionalty.
pdf.proxyURL String (default: null)
The URL of the server side proxy which will stream the file to the end
user.
A proxy will be used when the browser isn't capable of saving files
locally e.g. Internet Explorer 9 and Safari. PDF export is not
supported in Internet Explorer 8 and below.
The developer is responsible for implementing the server-side proxy.
The proxy will receive a POST request with the following parameters in
the request body:
contentType: The MIME type of the file base64: The base-64 encoded
file content fileName: The file name, as requested by the caller. The
proxy should return the decoded file with the "Content-Disposition"
header set to attachment; filename="".
I am using Parse Mobile Backend for my android app,but whenever I want to upload a large video more than the default 10mb limit for a ParseFileby getting the bytes from it into a ParseFile I keep running into the dreaded OutOfMemory Exception .So,I want to use the Parse REST API since I can easily use the setChunkedStreamingMode(1024) in HttpUrlConnectionto send the bytes in a chunked manner.The trouble is,how do I get the uploaded url of the file uploaded.Thanks for your help in advance.
i think you can use getUrl() method
ParseFile file = new ParseFile(byte[] data);
file.getUrl();
ParseFile object has getUrl() method to getting url of file. this method return URL in string format.
The issue was to do with the HTTP ACCEPT header not being accepted by Restify, the image rendering code is fine.
I have an image encoded as a base64 string, and I want to serve this as an image using node.js. Currently I've got the following code (I'm using Restify) which renders the image in Chrome OK, but the image doesn't render in other browsers (tried IE9, Firefox 4, Android browser):
var decodedBuffer = new Buffer(dataString,"base64");
res.send({
code: 200,
headers: {'Content-Type': 'image/png', 'Content-Length': decodedBuffer.length},
noEnd: true
});
res.write(decodedBuffer);
res.end();
Anyone able to shed some light on what I might be doing wrong??
Thanks
Use data URI syntax, which means you have to prefix the response with the data protocol and the MIME type, plus specify base64 encoding:
res.write("data:image/png;base64,"+decodedBuffer);