Jump to content


Photo

embedding audio data fread prob


  • Please log in to reply
3 replies to this topic

#1 nadeemshafi9

nadeemshafi9
  • Members
  • PipPipPip
  • Advanced Member
  • 1,245 posts
  • LocationUK

Posted 02 September 2006 - 04:26 PM

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

<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>


here is the troubled code

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

the prob occurs here the error is,

PHP Warning: fread(): supplied argument is not a valid stream resource in c:\Inetpub\wwwroot\audio_test\add_audio.php on line 20



thanx very much for any help
DONT LAY AN EGG OVER IT

#2 shocker-z

shocker-z
  • Members
  • PipPipPip
  • Advanced Member
  • 864 posts
  • LocationNottingham

Posted 02 September 2006 - 04:41 PM

$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...
www: www.ukchat.ws | irc: irc.ukchat.ws chan: #blufudge

#3 nadeemshafi9

nadeemshafi9
  • Members
  • PipPipPip
  • Advanced Member
  • 1,245 posts
  • LocationUK

Posted 02 September 2006 - 05:27 PM

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.
DONT LAY AN EGG OVER IT

#4 nadeemshafi9

nadeemshafi9
  • Members
  • PipPipPip
  • Advanced Member
  • 1,245 posts
  • LocationUK

Posted 02 September 2006 - 06:15 PM

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
DONT LAY AN EGG OVER IT




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users