blob

How do I send a binary blob to a client browser?

有些话、适合烂在心里 提交于 2019-12-10 11:57:56
问题 Pardon the dumb newbie question here; web programming isn't my forte... (blush) I have an aspx page running on a web server. I have a blob (byte array) containing any kind of binary file, plus a file name. I would like to push this file to be downloaded through the browser onto the client, and opened using whatever application is default for this file type. I really don't want to save the blob as a file on the server; that will leave a terrible housekeeping mess that I just don't want to

Sending Audio Blob to server

旧城冷巷雨未停 提交于 2019-12-10 11:29:53
问题 I am trying to send an audio blob produced by WebAudio API and Recorder.js to my Laravel Controller using jQuery's $.post method. Here is what I am trying. $('#save_oralessay_question_btn').click(function(e){ var question_content = $('#question_text_area').val(); var test_id_fr = parseInt($('#test_id_fr').val()); var question_type = parseInt($('#question_type').val()); var rubric_id_fr = $('#rubric_id_fr').val(); var reader = new FileReader(); reader.onload = function(event){ var form_data =

Read data from BLOB URL in Javascript

我的未来我决定 提交于 2019-12-10 11:06:58
问题 I have a BLOB URL, and I want to recreate it as a second BLOB URL, so that it is downloaded by default. var blob1 = new Blob(["Hello world!"], { type: "text/plain" }); url1 = window.URL.createObjectURL(blob1); blob2=new Blob([url1], {type: 'application/octet-stream'}); url2 = window.URL.createObjectURL(blob2); var a = document.createElement("a"); document.body.appendChild(a); a.style = "display: none"; a.href = url2; a.click(); window.URL.revokeObjectURL(url); See in JSFiddle: https:/

Downloading file by using JAX-RS together with ajax and javascript's blob object, doesn't work

放肆的年华 提交于 2019-12-10 10:59:27
问题 I trying to download file by using javascript's Blob object, but something weird is happening. First of all I use JAX-RS to send the file from backend, this is my code: Workbook wb = new HSSFWorkbook(); //creating workbook... ByteArrayOutputStream bos = new ByteArrayOutputStream(); try { wb.write(bos); bos.close(); } catch(Exception e) { e.printStackTrace(); } byte[] bytes = bos.toByteArray(); return Response.ok(bytes).header("Content-Disposition", "attachment; filename=" + "test.xls").build(

How to convert jpg image to proper blob data type using php

Deadly 提交于 2019-12-10 10:48:00
问题 <?php $file_name = $_FILES['files']['name']; $tmp_name = $_FILES['files']['tmp_name']; $file_size = $_FILES['files']['size']; $file_type = $_FILES['files']['type']; // The codes written above work fine and have proper information. $fp = fopen($tmp_name, 'r'); // This one crashes. $file_content = fread($fp, $file_size) or die("Error: cannot read file"); $file_content = mysql_real_escape_string($file_content) or die("Error: cannot read file"); fclose($fp); .... I'm a newbie to PHP stuff. I'm

Epub.js - Phonegap not working because of blob URI

有些话、适合烂在心里 提交于 2019-12-10 10:36:02
问题 I'm using Epub.js library to render a .epub file in a Phonegap project. The file gets fetched and unzipped correctly, but then the screen is displayed blank if running in WebView (Works perfect in Desktop and in android browser (Chrome app)). Debugging, I see that the iframe where the epub should be loaded doesn't work, as iframe.onload never gets called. The URL he's trying to access is blob:file%3A///85a6ce73-2b5f-430e-a908-26a7d3d830e4 , so I'm guessing that could be the reason... Cordova

Is it possible to write large strings to Firebird blob?

柔情痞子 提交于 2019-12-10 10:34:49
问题 The documentation for Firebird implies that you can write large (> 60K) strings to a blob value in a table. So if you have this: CREATE TABLE MyBlobTable ( theId int PRIMARY KEY NOT NULL, theBlob BLOB SUB_TYPE 1 ) Then this should work: insert into MyBlobTable (theId, theBlob) values (1, '[60K characters in a string]') (example inspired by http://web.firebirdsql.org/dotnetfirebird/blob-sub_type-1-reading-example-csharp.html) But I've found that neither C# drivers nor FlameRobin can write this

how to insert a huge file to BLOB (Oracle) without loading the complete file to memory?

丶灬走出姿态 提交于 2019-12-10 10:12:55
问题 We have a large file stored on our temporary file system, what I would be needing is to read that huge file (probably couple or few gigs) using BufferedInputStream as below InputStream is = is = new BufferedInputStream(new FileInputStream(file)); this will effectively decrease the time to read the file and wish to save the file to BLOB in DB (Oracle). Here is the real problem: I do not want the file to be completely read to my memory as Iam landing into Out of memory and want to read the

Django Binary or BLOB model field

浪尽此生 提交于 2019-12-10 02:23:29
问题 I have a C# program that inserts a pdf inside a MySQL database. Now I want to retrieve that pdf via django but django's models.FileField needs an "Upload To" parameter which means behind the scenes it actually stores the File on the file system rather than in the database. Is there any way I can set up a django model so that I can store the pdf directly inside MySQL? Regards 回答1: I have been dealing with this same issue, writing a pdf to a mediumblob field in mysql and retrieving via django.

CloudBlob.DownloadToStream returns null

≡放荡痞女 提交于 2019-12-10 02:04:08
问题 I'm trying to download a file from cloudBlob via stream. I refer to this article CloudBlob Here is the code to download the blob public Stream DownloadBlobAsStream(CloudStorageAccount account, string blobUri) { Stream mem = new MemoryStream(); CloudBlobClient blobclient = account.CreateCloudBlobClient(); CloudBlockBlob blob = blobclient.GetBlockBlobReference(blobUri); if (blob != null) blob.DownloadToStream(mem); return mem; } And the code to convert it into byte array public static byte[]