Jump to content

Archived

This topic is now archived and is closed to further replies.

nadeemshafi9

embedding audio data fread prob

Recommended Posts

hi again

i am having trouble readin my audio data to place it into a db here is the code in question

here is the form that i use

[code] <form action="add_audio.php" method="post" name="frmdetails" enctype="multipart/form-data">
audio
<input name="fileaudio" type="file" accept="audio/basic">
<br>
<input name="submit" type="submit" value="Submit">
</form>[/code]


here is the troubled code

[code] $audiodata = $_FILES['fileaudio']['tmp_name'];
$audiodata = addslashes(fread(fopen($audiodata, "r"), filesize($audiodata)));[/code]

the prob occurs here the error is, [quote]PHP Warning: fread(): supplied argument is not a valid stream resource in c:\Inetpub\wwwroot\audio_test\add_audio.php on line 20 [/quote]

thanx very much for any help

Share this post


Link to post
Share on other sites
$audiodata = $_FILES['fileaudio']['tmp_name'];
$fopen=fopen($audiodata, "r");
$size=filesize($audiodata);
$fread=fread($fopen, $size);
$audiodata = addslashes($fread);

try that... not tested.. but i think it's mainly because of the functions working inside a function and reading the file at same time as checking it...

Share this post


Link to post
Share on other sites
ok i tryed that know its still having a prob with fread due to fopen, the same error (not a valid stream resource), the file is infact an mp3 file, and in the form iv speccified basic audio, and multipart form data.

there seems to be a loss in the file post,

thancks for any further assistance.

Share this post


Link to post
Share on other sites
i tried a smaller midi sequence file a couple of k and it woorked,

the one i used before was mp3 and was 5 mb so i think there is a limitation here or somthing if anyone has any ideas to how to overcome this please feel free to help.

thanx all

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.