Saving a video file to mysql database..

Just starting out? Need help? Post your questions and find answers here.
shire
User
User
Posts: 46
Joined: Mon Jul 25, 2011 5:24 am

Saving a video file to mysql database..

Post by shire »

Hello,

Does anyone tried saving a video file in mysql database?

I tried using this code:

Code: Select all

              file$ = OpenFileRequester("Choose a file", "", pattern$, 0)
              
              If ReadFile(0, file$)
                length = Lof(0)
                *filereadbuffer = AllocateMemory(length)
                ReadData(0,*filereadbuffer,length)                
                
                filename$ = GetFilePart(file$) 
                If file$<>"" 
                  now$ = FormatDate("%yyyy%mm%dd",Date())    
                  SetDatabaseBlob(0, 0, *filereadbuffer, Length)
                 DatabaseUpdate(0, "INSERT INTO file (control, file, filesize, filename) VALUES ("+"'"+controlnum+"',?, "+"'"+Str(Length)+"', "+"'"+filename$+"')")
                   Else
                 MessageRequester("Warning","Can't save record!",#MB_ICONEXCLAMATION)
                EndIf  
              Else
                MessageRequester("Error","Couldn't read file!", #MB_ICONERROR)
              EndIf
but it doesn't save video files although it saves other files.

Any idea? please help..

Thank you in advance:)
kinglestat
Enthusiast
Enthusiast
Posts: 746
Joined: Fri Jul 14, 2006 8:53 pm
Location: Malta
Contact:

Re: Saving a video file to mysql database..

Post by kinglestat »

its same as sending a blob. I had to stop using the PB libraries due to bugs when inserting large data....I would recomend using the mysql DLL lib directly. Look for libmysql_fr.pbi then add the functions you need
I may not help with your coding
Just ask about mental issues!

http://www.lulu.com/spotlight/kingwolf
http://www.sen3.net
shire
User
User
Posts: 46
Joined: Mon Jul 25, 2011 5:24 am

Re: Saving a video file to mysql database..

Post by shire »

@kinglestat:

thank you your reply..

but I still can't make it work..
User avatar
captain_skank
Enthusiast
Enthusiast
Posts: 639
Joined: Fri Oct 06, 2006 3:57 pm
Location: England

Re: Saving a video file to mysql database..

Post by captain_skank »

I gave up with storing files in mysql.

I just store the location and filename of the file in the database now, cuts out any confusion :)
Post Reply