Have a stack that records and uploads audio to a mySQL database. Trying to create a stack that allows users to hear/download the audio in the database. The audio is uploading correctly, but the file being downloaded is text. Any Idea what I'm doing wrong?
put revDataFromQuery(tab,return,dbid,"SELECT response FROM results where assignment_ID = :1 AND name = :2 AND question = 1", "dbdata") into url ("binfile:test.wav")
Thanks,
Mike
downloading audio files from mySQL
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Hi Mike,
There are often problems with binary data. It will probably work if you base64encode the data before writing it to the database. Retrieve it as base64 and decode it before writing to disk.
Best,
Mark
There are often problems with binary data. It will probably work if you base64encode the data before writing it to the database. Retrieve it as base64 and decode it before writing to disk.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
re: downloading audio files from mySQL
Thanks Mark ... will give that a try.
- mike
- mike
-
- VIP Livecode Opensource Backer
- Posts: 1005
- Joined: Sat Apr 08, 2006 3:06 pm
- Location: Overland Park, Kansas
- Contact:
revDataFromQuery is going to deliver all results as text, not binary data. If you want to extract binary data from MySQL using revDB then you need to look at revDatabaseColumnNamed. Untested but something like this should work:
Code: Select all
put "SELECT response FROM results where assignment_ID = :1 AND name = :2 AND question = 1" into theSQL
put revQueryDatabase(dbid, theSQL, "dbdata") into theCursor
put revDatabaseColumnNamed(theCursor, "response", "theBinaryData") into theError
if theError is empty then
put theBinaryData into url("binfile:test.wav")
else
answer "Error:" && theError
end if
Trevor DeVore
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder
ScreenSteps - https://www.screensteps.com
LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder