Jump to content

embedding audio data fread prob


nadeemshafi9

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
Link to comment
https://forums.phpfreaks.com/topic/19486-embedding-audio-data-fread-prob/
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...
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.
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

Archived

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

×
×
  • Create New...

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.