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
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...
Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.