nadeemshafi9 Posted September 2, 2006 Share Posted September 2, 2006 hi againi am having trouble readin my audio data to place it into a db here is the code in questionhere 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 More sharing options...
shocker-z Posted September 2, 2006 Share Posted September 2, 2006 $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 https://forums.phpfreaks.com/topic/19486-embedding-audio-data-fread-prob/#findComment-84652 Share on other sites More sharing options...
nadeemshafi9 Posted September 2, 2006 Author Share Posted September 2, 2006 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 https://forums.phpfreaks.com/topic/19486-embedding-audio-data-fread-prob/#findComment-84668 Share on other sites More sharing options...
nadeemshafi9 Posted September 2, 2006 Author Share Posted September 2, 2006 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 Link to comment https://forums.phpfreaks.com/topic/19486-embedding-audio-data-fread-prob/#findComment-84709 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.