Search Results

Search found 3 results on 1 pages for 'dmullins'.

Page 1/1 | 1 

  • Opening Blob Data stored in Sqlite as a File with Tcl/Tk

    - by dmullins
    I am using the following tcl code to store a file from my deskstop into a Sqlite database as blob data ($fileText is a path to a text file): sqlite3 db Docs.db set fileID [open $fileText RDONLY] fconfigure $fileID -translation binary set content [read $fileID] close $fileID db eval {insert into Document (Doc) VALUES ($content)} db close I have found many resources on how to open the blob data to read and write to it, but I cannot find any resources on openning the blob data as a file. For example, if $fileText was a pdf, how would I open it, from Sqlite, as a pdf?

    Read the article

  • How to Pass a JS Variable to a PHP Variable

    - by dmullins
    Hello: I am working on a web application that currently provides a list of documents in a MySql database. Each document in the list has an onclick event that is suppose to open the specific document, however I am unable to do this. My list gets popluated using Ajax. Here is the code excerpt (JS): function stateChanged() { if (xmlhttp.readyState==4) { //All documents// document.getElementById("screenRef").innerHTML="<font id='maintxt'; name='title'; onclick='fileopen()'; color='#666666';>" + xmlhttp.responseText + "</font>"; } } } The onclick=fileopen event above triggers the next code excerpt, which downloads the file (JS): function stateChanged() { if (xmlhttp.readyState==4) { //Open file var elemIF = document.createElement("iframe"); elemIF.src = url; elemIF.style.display = "none"; document.body.appendChild(elemIF); } } } Lastly, the openfile onclick event triggers the following php code to find the file for downloading (php): $con = mysql_connect("localhost", "root", "password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("Documents", $con); $query = mysql_query("SELECT name, type, size, content FROM upload WHERE name = NEED JS VARIABLE HERE"); $row = mysql_fetch_array($query); header ("Content-type: ". $row['type']); header ("Content-length: ". $row['size']); header ("Content-Disposition: attachement; filename=". $row['name']); echo $row['content']; This code works well, for downloading a file. If I omit the WHERE portion of the Sql query, the onclick event will download the first file. Somehow, I need to get the screenRef element text and change it into a variable that my php file can read. Does anyone know how to do this? Also, without any page refreshes. I really appreciate everyone's feedback and thank you in advance. DFM

    Read the article

  • Openning Blob Data stored in Sqlite as a File with Tcl/Tk

    - by dmullins
    Hello: I am using the following tcl code to store a file from my deskstop into a Sqlite database as blob data ($fileText is a path to a text file): sqlite3 db Docs.db set fileID [open $fileText RDONLY] fconfigure $fileID -translation binary set content [read $fileID] close $fileID db eval {insert into Document (Doc) VALUES ($content)} db close I have found many resources on how to open the blob data to read and write to it, but I cannot find any resources on openning the blob data as a file. For example, if $fileText was a pdf, how would I open it, from Sqlite, as a pdf? Thanks, DFM

    Read the article

1