Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: How to read a stored file from database and show in browser

by mje (Deacon)
on Jul 11, 2013 at 16:20 UTC ( #1043771=note: print w/ replies, xml ) Need Help??


in reply to How to read a stored file from database and show in browser

It is not what you asked but lines 41 to 53 look wrong to me. Firstly if that while loop is executed more than once (in otherwords if $maxlen is less than the size of the file) you will insert multiple rows into your table. You are probably getting away with this because your manual.pdf is smaller than maxlen. Also wouldn't it be better to check what read returns rather than what has been read.

Also, what if max_allocated_packet was less than 100_000 - you've got a problem.

Lastly, are you sure you want a unique constraint on the combination of id and name? As id is an auto increment that will mean you can have two rows with the same name. Your remove sub rather suggests you expect name to be unique but that is a guess on my part.


Comment on Re: How to read a stored file from database and show in browser
Re^2: How to read a stored file from database and show in browser
by ghosh123 (Monk) on Jul 11, 2013 at 18:00 UTC

    Thanks for pointing out the bugs.
    Can you please help me on the displaying of that stored file in browser . Not to forget, saving the file in server by downloading from the database is not an option.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1043771]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (14)
As of 2014-07-31 17:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (249 votes), past polls