download file from database, upload to a file server
Moderator: General Moderators
download file from database, upload to a file server
Hi,
I have some files stored in the database as longblob, with the filenames as well.
I want to download these files from the database and save them on a remote file server.
I do not want to download the files using a url which is a common practice, rather the download from the mySQL database and upload to the file server should happen without the user's intervention. I need to run some tests on the file , on the remote server. These files need to be in the database because other users need to use them as well.
Is there a way to do this?
I would appreciate any help.
Thanks
I have some files stored in the database as longblob, with the filenames as well.
I want to download these files from the database and save them on a remote file server.
I do not want to download the files using a url which is a common practice, rather the download from the mySQL database and upload to the file server should happen without the user's intervention. I need to run some tests on the file , on the remote server. These files need to be in the database because other users need to use them as well.
Is there a way to do this?
I would appreciate any help.
Thanks
e.g. file_put_contents() works with some url wrappers like ftp
There's always the FTP functions.
But the ssh2 extension does not provide a function to send something else than a file.
Maybe you can use http://de2.php.net/manual/en/wrappers.ssh2.php
Maybe you can use http://de2.php.net/manual/en/wrappers.ssh2.php
- tecktalkcm0391
- DevNet Resident
- Posts: 1030
- Joined: Fri May 26, 2006 9:25 am
- Location: Florida
Code: Select all
header("Content-type: text/richtext"); // what ever the content is
header('Content-Disposition: attachment; filename="'.$filename.'"'); // send as download and filename as
echo $the_file; // echo file dataThere is an example at http://de2.php.net/manual/en/wrappers.ssh2.php
this will send the data to the client/browser, not another file server.tecktalkcm0391 wrote:Don't know if that would work.Code: Select all
header("Content-type: text/richtext"); // what ever the content is header('Content-Disposition: attachment; filename="'.$filename.'"'); // send as download and filename as echo $the_file; // echo file data