469,926 Members | 1,824 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,926 developers. It's quick & easy.

To get the data stored as blob in .doc format using javascript

Hi

i would like to know, how to retrieve data stored as blob in database in the format required for displaying. one suggestion i got was of using poi package. i would like to know whether it is possible to do the same using javascript alone. that is , without using any additional softwar

waiting for early reply
Feb 26 '07 #1
4 2561
acoder
16,027 Expert Mod 8TB
You can't use Javascript alone. You will need Ajax to connect to the server. The server will do the bulk of the work including connecting to the database, getting the data and converting it to a format readable by Javascript, e.g. XML, plain text, etc.
Feb 27 '07 #2
thanks for ur reply

but i will be thankful to u if u can provide me with a sample code
Mar 2 '07 #3
acoder
16,027 Expert Mod 8TB
thanks for ur reply

but i will be thankful to u if u can provide me with a sample code
LOL, you already have been thankful!

Well, do you know Ajax? If not, read this simple tutorial. The code could be better, but it'll get you started. If you want, you can libraries or frameworks that deal with all the cross-browser issues.

Secondly, you will need a server-side language. Which one are you using?
Mar 2 '07 #4
i hope this guides you to the right direction. this will dump the file straight to the browser.
so for example i can do this: <img src="getImage.php?id=1" />

Expand|Select|Wrap|Line Numbers
  1. <!-- getImage.php -->
  2. <?php
  3.  
  4. $imageID = $_GET['id'];
  5. $image = $_GET['thumb'];
  6.  
  7. include('/home/serverConnection.php');
  8.  
  9. if($image == "yes")
  10. {
  11. $sql = "SELECT PhotoType, PhotoThumb FROM Photos WHERE   PhotoID='$imageID'";
  12.  
  13. $result = mysql_query($sql);
  14. $row = mysql_fetch_assoc($result);
  15. $image = $row['PhotoThumb'];
  16. $type = $row['PhotoType'];
  17. }
  18. else
  19. {
  20. $sql = "SELECT PhotoType, PhotoMain FROM Photos WHERE PhotoID='$imageID'";
  21.  
  22. $result = mysql_query($sql);
  23. $row = mysql_fetch_assoc($result);
  24. $image = $row['PhotoMain'];
  25. $type = $row['PhotoType'];
  26. }
  27.  
  28.  
  29. header('Content-Type: ' . $type);
  30. echo $image;
  31.  
  32. ?>
  33.  
Oct 23 '10 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by hamvil79 | last post: by
6 posts views Thread by Rod Snyder | last post: by
6 posts views Thread by | last post: by
7 posts views Thread by greywire | last post: by
5 posts views Thread by Tarscher | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.