Highlighted

Oracle db: Get file size from BLOB datatype

LEGEND ,
Sep 26, 2017

Copy link to clipboard

Copied

Hello, all,

I've got a table in an Oracle 12g db that is BLOB for storing files.  I'm trying to find a way to get the size of a single file contained within the BLOB column.

I am not saving the file to the server before inserting it into the db; it is going straight to the db to cut down on disk i/o, so I can't get the file size before inserting.

Any thoughts?

V/r,

^ _ ^

Nevermind.  This has become a non-issue.  Given the lack of activity on the Adobe forums, and pressing time to get things done, I have been forced into a rather hackish way of getting the information I require.  I am posting the solution below.

I am now using JavaScript "files" API to include the filesize with the filename during upload, delimited by a pipe (|), and am using REGEXP_SUBSTR() in the select query to distinguish between the filename and size for display purposes.

I hate doing it this way, but don't have much choice as the project is launching on Monday.

V/r,

^ _ ^

var fileInput = document.getElementById('upload'), files = fileInput.files, fileName = files[0].size + "|" + files[0].name;

$('#fileName').val(fileName);

After upload:

SELECT REGEXP_SUBSTR(doc_name,'[^|]+',1,1) "DOC_SIZE", REGEXP_SUBSTR(doc_name,'[^|]+',1,2) "DOC_NAME"

FROM documents doc

TOPICS
Database access

Views

848

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Oracle db: Get file size from BLOB datatype

LEGEND ,
Sep 26, 2017

Copy link to clipboard

Copied

Hello, all,

I've got a table in an Oracle 12g db that is BLOB for storing files.  I'm trying to find a way to get the size of a single file contained within the BLOB column.

I am not saving the file to the server before inserting it into the db; it is going straight to the db to cut down on disk i/o, so I can't get the file size before inserting.

Any thoughts?

V/r,

^ _ ^

Nevermind.  This has become a non-issue.  Given the lack of activity on the Adobe forums, and pressing time to get things done, I have been forced into a rather hackish way of getting the information I require.  I am posting the solution below.

I am now using JavaScript "files" API to include the filesize with the filename during upload, delimited by a pipe (|), and am using REGEXP_SUBSTR() in the select query to distinguish between the filename and size for display purposes.

I hate doing it this way, but don't have much choice as the project is launching on Monday.

V/r,

^ _ ^

var fileInput = document.getElementById('upload'), files = fileInput.files, fileName = files[0].size + "|" + files[0].name;

$('#fileName').val(fileName);

After upload:

SELECT REGEXP_SUBSTR(doc_name,'[^|]+',1,1) "DOC_SIZE", REGEXP_SUBSTR(doc_name,'[^|]+',1,2) "DOC_NAME"

FROM documents doc

TOPICS
Database access

Views

849

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sep 26, 2017 0
LEGEND ,
Sep 27, 2017

Copy link to clipboard

Copied

Nevermind.  This has become a non-issue.  Given the lack of activity on the Adobe forums, and pressing time to get things done, I have been forced into a rather hackish way of getting the information I require.  I am posting the solution below.

I am now using JavaScript "files" API to include the filesize with the filename during upload, delimited by a pipe (|), and am using REGEXP_SUBSTR() in the select query to distinguish between the filename and size for display purposes.

I hate doing it this way, but don't have much choice as the project is launching on Monday.

V/r,

^ _ ^

var fileInput = document.getElementById('upload'), files = fileInput.files, fileName = files[0].size + "|" + files[0].name;

$('#fileName').val(fileName);

After upload:

SELECT REGEXP_SUBSTR(doc_name,'[^|]+',1,1) "DOC_SIZE", REGEXP_SUBSTR(doc_name,'[^|]+',1,2) "DOC_NAME"

FROM documents doc

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 27, 2017 0