RE: Downloading file from local network machine

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Cheers Ash et al... got it working now using fileread(), based on the
example on php.net. I have it in a separate download.php file which
takes a variety of inputs and spews out a file download.

Many thanks all.

-----Original Message-----
From: Ashley Sheridan [mailto:ash@xxxxxxxxxxxxxxxxxxxx] 
Sent: 05 December 2008 20:23
To: Mayer, Jonathan
Cc: Wolf; php-general@xxxxxxxxxxxxx
Subject: RE:  Downloading file from local network machine

On Fri, 2008-12-05 at 17:32 +0000, Mayer, Jonathan wrote:
> Thanks Wolf :)
> 
> Yup, I had considered that, although there could be up to 8 different
servers so that's 8 seperately mapped drives. 
> 
> If that's the simplest/neatest way, I'll do that, although I did
wonder whether there was some other clever another way around it.
> 
> -----Original Message-----
> From: Wolf [mailto:lonewolf@xxxxxxxxx] 
> Sent: 05 December 2008 17:29
> To: Mayer, Jonathan; php-general@xxxxxxxxxxxxx
> Subject: Re:  Downloading file from local network machine
> 
> <!-- SNIP --> 
> > I  would like to present users to our internal intranet with a link
to
> > download a file from a folder on a different machine on our local
> > network (such as \\computername\folder\file)
> <!-- SNIP --> 
> 
> Map the drive to the server so that it is accessible as /folder/file
on the website.
> 
> Voila, no more problem.
> 
> HTH,
> Wolf
> 
> 
I don't have the code to hand right now, but I can try and post it
later. You were on the right track with fread() et al. Basically, set
the correct headers for a download (application/octet-stream I believe)
and print out the results of the fread(). Don't forget the binary flag
on fread() if you are opening binary files, and it should create a file
that auto-downloads. There are extra headers to set the default filename
of the download, but I forget these at the moment. A Google should give
you what you need though. This way, the file can even be delivered to
someone outside of your network should you wish, without you needing to
put the file in a web-accessible directory.


Ash
www.ashleysheridan.co.uk




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux