Using php to upload files to remote WEBdav server

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
akronymn
Forum Newbie
Posts: 7
Joined: Wed Jul 02, 2008 12:31 pm

Using php to upload files to remote WEBdav server

Post by akronymn »

I am currently building a site that is hosted on one server but contains links to videos hosted on a remote server. I want to allow users to upload videos which my script will move to the remote server. The remote server requires authentication. This is the first time I have done anything like this so I'm not even sure where to begin. The remote server has an address starting with http:// so I'm guessing I'll have to transfer the videos via http. Some basic info is below but I'll be more than happy to provide any other info that would help me get moving. Thanks!


local server: apache 2.0.63.200
local OS : WINNT
PHP version: 4.3.11
remote server: WEBDav
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Using php to upload files to remote WEBdav server

Post by Benjamin »

There are numerous ways to do this, but posting video files to a remote server doesn't make the short list.

I'd probably go with FTP for FISH for something like this.

Here's a start: http://us2.php.net/manual/en/book.ftp.php
akronymn
Forum Newbie
Posts: 7
Joined: Wed Jul 02, 2008 12:31 pm

Re: Using php to upload files to remote WEBdav server

Post by akronymn »

OK so I've made some progress using HTTP_WebDAV_client but I've hit another wall. Here is the gist of my code:

stream_register_wrapper("webdav", "HTTP_WebDAV_Client_Stream");

$src_vid_path ="c:\\apache\\htdocs\\tempVideos\\";
$target_vid_path = 'webdav://*****.com/WMRoot/ce/'.$full_tid.'.wvx';

$src = fopen($tmp_vid_path, "rb");
$tgt = fopen($target_vid_path, "wb");

rename($src, $tgt);

I've checked and rechecked that my URL's are correct and that the source video is actually where it should be. Here is the error I get though:

Warning: fopen(webdav://...@stream.mediascape.com/WMRoot/ce/M102722_1cd7_1ce6.wvx): failed to open stream: "http_webdav_client_stream::stream_open" call failed in C:\apache\htdocs\uploader.php on line 53
Warning: rename(Resource id #25,): No such file or directory in C:\apache\htdocs\uploader.php on line 58

Thanks for the help!
Post Reply