On 3/27/01 4:54 PM, "WeAreUs" <[EMAIL PROTECTED]> wrote:

> 
> Hi!
> 
> I enter some .wav encoded (windows) data into a MySql table as follows:
> 
>     $data = addslashes(fread(fopen($form_data, "r"),
> filesize($form_data)));
>    $result=MYSQL_QUERY("INSERT INTO
> b(audio,filename,filesize,filetype,audio_description) ".
>       "VALUES
> ('$data','$form_data_name','$form_data_size','$form_data_type',
> '$audio_description')");
>      $uid= mysql_insert_id();
> 
> 
> Later, I try to reconstruct the original audio file as follows:
> 
>       $query = mysql_query("select audio from dupe_b where uid='87' into
> outfile 'c:/windows/desktop/ZZZZdata.wav' ");
> 
> This does not yield the correct format.   I take it that I require "fields
> terminated by...." or something like that to make this work.   However, I
> cannot get any further with this.
> 
> Any suggestions?
> 
> Thanks for the time!
> 

Have you tried putting the returned value into a variable, opening up a file
for writing(as binary)
In php (which it looks like you are using)

$fh=fopen('newfile.wav','wb');
fputs($fh,$fielddata);
fclose($fh);

I think that selecting into an outfile does some textencoding and newline
conversion type stuff (just guessing).

The above is the way I would do it, if I had to put my files into a db.

I would rather store my files, as files, in a directory, and store the meta
information (file location, name,size,description,copyright whatever) in the
database.
It is so much easier to have the file path/name inserted into the html, than
to pull all the data out, create the file, insert the filename, server up
the html.


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to