Current location: Hot Scripts Forums » Programming Languages » PHP » inserting sounds to DB


inserting sounds to DB

Reply
  #1 (permalink)  
Old 04-28-04, 10:48 PM
mivec mivec is offline
Newbie Coder
 
Join Date: Mar 2004
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy inserting sounds to DB

hi all,
errmmm....i am not sure how to do this...i have done uploading of images where i only upload the path of the image.like this:

PHP Code:

//checking with this
function  checkfile($inputname,$inputsize,$inputtype,$size){
 global 
$error
  
 if(
$inputsize==0){ 
  
$error[]="Please select a picture for your product!"
 }
 elseif(
$inputsize>$size){ 
  
$error[]="File size can be maximum ".$size." bytes!"
 }
 elseif(
is_uploaded_file($inputname)){ 
  
$file_type=$inputtype
  
$allowed_types=array("image/bmp","image/gif","image/pjpeg","image/jpeg"); 

  if(!
in_array($file_type$allowed_types))
   
$error[]="File type not permitted! (Please use jpg, jpeg, bmp, or gif images)"
 } 

PHP Code:

//inserting to database
 
$uploaddir "img/userPics/"
     
    if(!
file_exists($uploaddir))
     { 
          
mkdir($uploaddir0777);
     } 
         
  
// check file
 
checkfile($_FILES['file']['tmp_name'], $_FILES['file']['size'], $_FILES['file']['type'],500000);
    
            if(!isset(
$error))
       { 
       
$date date("YmdHis");
       
$done copy($_FILES['file']['tmp_name'],$uploaddir.$date.'.jpg');
      }
      
    if (
$done)
       {
       
$query "INSERT INTO tblgallery (pic_Path, username, pic_Num) VALUES ('" addslashes($uploaddir) . $date ".jpg', '" $_POST["txtUsername"] . "', '" $num "')";
       
mysql_query($query) or 
       die (
mysql_error()); 
so....i don't know if it can be done the same way for sounds like mp3 or wav or whatever...pls advice..thank you.
Reply With Quote
  #2 (permalink)  
Old 04-29-04, 04:52 AM
wessamzeidan wessamzeidan is offline
Newbie Coder
 
Join Date: Apr 2004
Location: Lebanon
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
If you want to store the names of the sound files only, then its done the exact same you, just change the extentions
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
php/mysql inserting twice into database with IE 6 sky4est PHP 3 04-22-04 12:46 PM
simple board that shares db with phpbb Greener Script Requests 1 04-21-04 07:12 AM
inserting data to mysql with php mathieu67 PHP 2 04-16-04 08:42 AM
inserting images into mysql coatsey PHP 3 12-01-03 07:04 PM
getting -2147217900 error while inserting and updating skchakri ASP 3 09-20-03 10:34 AM


All times are GMT -5. The time now is 10:30 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.