473,702 Members | 2,645 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

download file

Ken
How do I download files from the internet server to my computer?

How do I tell the script the correct hard drive folder on my computer to
copy the files to?

After connecting to the internet server, I am trying:

$_SESSION['archive_dir_re ad'] = "/uploaddir/"; // directory on server
$_SESSION['archive_dir_st ore'] = "c:/_picture_file/"; // directory on
computer

copy($_SESSION['archive_dir_re ad'].$_SESSION['picture1'],
$_SESSION['archive_dir_st ore'].$_SESSION['picture1'])

$_SESSION['picture1'] is the file name

How do I address my computer from the internet?

ftp://c:/_picture_file/

or http://c:/_picture_file/

http://ip address/c:/_picture_file/

Thanks for the help.

Ken
Jul 17 '05 #1
13 3641
*** Ken wrote/escribi (Wed, 18 Aug 2004 08:11:16 GMT):
How do I address my computer from the internet?


Luckily, that's impossible! Let your web browser download it. Point browser
to http://domain.com/folder/file.extension and then use the "Save as"
option.
--
-- lvaro G. Vicario - Burgos, Spain
-- Questions sent to my mailbox will be billed ;-)
--
Jul 17 '05 #2
Ken
> > How do I address my computer from the internet?
I can see why that is not done!!

Can I place the download script on my computer and pull the files down to my
hard drive?

Rather than push them down from the internet server.

I have a number of files; the number will vary and is controlled by the
webpage I am writing. The viewer uploads the files to a server directory.
I need to find an PHP script to transfer the files to my computer. I would
like PHP to automatically download the proper file.

There must be way of taking the files off the internet server and moving
them to my hard drive.

How do I do that?
Can I configure the copy command to do that?

Thanks for the help.

Ken

$_SESSION['archive_dir_re ad'] = "/uploaddir/"; // directory on
server
$_SESSION['archive_dir_st ore'] = "c:/_picture_file/"; // directory on
computer

copy($_SESSION['archive_dir_re ad'].$_SESSION['picture1'],
$_SESSION['archive_dir_st ore'].$_SESSION['picture1'])

$_SESSION['picture1'] is the file name
"Alvaro G Vicario" <al************ ******@telecomp uteronline.com> wrote in
message news:1h******** *************** *****@40tude.ne t...
*** Ken wrote/escribi (Wed, 18 Aug 2004 08:11:16 GMT):
How do I address my computer from the internet?
Luckily, that's impossible! Let your web browser download it. Point

browser to http://domain.com/folder/file.extension and then use the "Save as"
option.
--
-- lvaro G. Vicario - Burgos, Spain
-- Questions sent to my mailbox will be billed ;-)
--

Jul 17 '05 #3
*** Ken wrote/escribi (Wed, 18 Aug 2004 09:16:46 GMT):
Can I place the download script on my computer and pull the files down to my
hard drive?


Sure, but of course you need the adequate environment (a web server
accesible from outside and a PHP interpreter). It's probably easier to just
use a download tool like GetRight or wget and program the download. Some of
them (esp. wget) are very flexible.
--
-- lvaro G. Vicario - Burgos, Spain
-- Questions sent to my mailbox will be billed ;-)
--
Jul 17 '05 #4
Ken
I have apache server on my computer also php.

Do I have to change the configuration on the server to access the outside?
I use the server to develop the php and MySql scripts.

Can you suggest a script a script?

I really appreciate the help!

Ken

"Alvaro G Vicario" <al************ ******@telecomp uteronline.com> wrote in
message news:aa******** *************** *****@40tude.ne t...
*** Ken wrote/escribi (Wed, 18 Aug 2004 09:16:46 GMT):
Can I place the download script on my computer and pull the files down to my hard drive?
Sure, but of course you need the adequate environment (a web server
accesible from outside and a PHP interpreter). It's probably easier to

just use a download tool like GetRight or wget and program the download. Some of them (esp. wget) are very flexible.
--
-- lvaro G. Vicario - Burgos, Spain
-- Questions sent to my mailbox will be billed ;-)
--

Jul 17 '05 #5
*** Ken wrote/escribi (Wed, 18 Aug 2004 16:58:31 GMT):
Do I have to change the configuration on the server to access the outside?
I use the server to develop the php and MySql scripts.


It really depends on many factors: Apache config, firewalls, routers...
Apache must be listening your PC's external IP (not only 127.0.0.1),
firewall must allow external access to port 80 and routers must have NAT
configured to send traffic to your computer.

--
-- lvaro G. Vicario - Burgos, Spain
-- Questions sent to my mailbox will be billed ;-)
--
Jul 17 '05 #6
Ken
"Alvaro G Vicario" <al************ ******@telecomp uteronline.com> wrote in
message news:14******** *************** ******@40tude.n et...
*** Ken wrote/escribi (Wed, 18 Aug 2004 16:58:31 GMT):
Do I have to change the configuration on the server to access the outside? I use the server to develop the php and MySql scripts.


It really depends on many factors: Apache config, firewalls, routers...
Apache must be listening your PC's external IP (not only 127.0.0.1),
firewall must allow external access to port 80 and routers must have NAT
configured to send traffic to your computer.

--
-- lvaro G. Vicario - Burgos, Spain
-- Questions sent to my mailbox will be billed ;-)
--


I set up PHP as follows: But the file save dialog box does not open in
Internet Explorer version 6.0.2800.1106.

$type = image/pjpeg
$size = 3548
$pict = the-picture-name.jpg

header("Content-type: application/$type");
header("Content-disposition: attachment; filename=$pict" );
header("Content-length: $length");
readfile('$pict ');

What am I doing wrong?

Thanks!

Ken
Jul 17 '05 #7
Ken
$file = directory/WI-1117-01.gif
header( "Content-Description: File Transfer" );
header("Expires : 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");

//header( "Content-Type: application/force-download" );
header( "Content-Type: image/gif" );
header( "Content-Disposition: attachment; filename=test.g if" );
header( "Content-length: ".filesize($fil e));
header( "Content-Transfer-Encoding: binary" );

$testt = readfile($file) ;
echo "<br><br>te stt = ".$testt;

echo "<br><br>Comple ted";

-------------------------------------------------------
I have made some changes.

I can now display the ASCII code for the image on my screen. The image is
the visa.gif

WI-1117-01.gif , image/gif , 518
GIF89a8$33f3f3 ff3fTffTfTTTTT3 fTTT TT3TffT ,8$@
"ZdizhSpܲm mB9^,T`( @AZGtJ=2O zxL~ z=:OC`%:
( X-wr:URSC#X "u 7"OI'?S\eoz^nZ 54lj*[hU="- <
5-Y?P<?T8"--:MfPG 5CBE , T>Y
..VHJfs `Z"?'BoxJ! ?jOJs ' <;$uuoB ' "
",<-s<'T,.Z@fd ~?5hB
*QG\?,I X@"Y??? ?.?]#oqrO893` `
"̍HTS ~\̹K/S&;

testt = 518 // this is the result of readfile statement. The file size.
So I am now in contact with the correct file, file size, and have downloaded
the file as ASCII to the screen but did not saved it as a file (test.gif) on
my hard drive.

Completed
-------------------------------------------------

I read there is a problem with IE 6.0 I could not find a fix for it.

Do you know the file name or number for the fix? Q??? K???
Is the above script correct for readfile() and the headers?

Ken
Jul 17 '05 #8
*** Ken wrote/escribi (Mon, 23 Aug 2004 21:44:19 -0500):
readfile('$pict ');


That way you're reading a file called $pict. Variables are not parsed
within single quotes. Try:

readfile($pict) ;
--
-- lvaro G. Vicario - Burgos, Spain
-- Questions sent to my mailbox will be billed ;-)
--
Jul 17 '05 #9
*** Ken wrote/escribi (Tue, 24 Aug 2004 01:37:28 -0500):
$testt = readfile($file) ;
echo "<br><br>te stt = ".$testt;

echo "<br><br>Comple ted";


The echo's are fine for debugging but, of course, if you use them in the
final script your file will be messed.

--
-- lvaro G. Vicario - Burgos, Spain
-- Questions sent to my mailbox will be billed ;-)
--
Jul 17 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
6123
by: Brandon Walters | last post by:
I wrote a file download module for my website. The reason for the file download module is that my website downloads work on a credit based system. So I need to keep track of and limit daily downloads. It uses fpassthru() and some headers() to send a file to the requesting user. The get.php file that I wrote (the file download module if you will) works like a charm for .ZIP files and .TXT files. However, when .EXE files are downloaded...
0
1829
by: Buddy Ackerman | last post by:
I am trying to implment a file download via a link such that when clicked, instead of starting the default application for that type of file the user will be presented with a download dialog window. Well, thanks to Steve Orr, I have that working. However, I still have a few issues. First, the download dialog does not have the name of the file being downloaded in the "File name" field, instead it has the name of the aspx page that have...
0
1740
by: Rhys666 | last post by:
Basically I have a link that opens my download page and the querystring identifies the type of 'template' Excel spreadsheet has asked to download. The download page reads the querystring, identifies the template required then uses Response.AppendHeader to amend the response to create the file download dialogue. On my local machine this works fine and the download dialogue correctly identifies the file name and type attempting to be...
4
2332
by: Nathan Sokalski | last post by:
I want to give visitors to my site the option of downloading a generated ..txt file by clicking a button. I know how to generate text files, but how do I cause the browser to pop up one of those dialog boxes that says something like "Do you want to download FILEX.txt?" I want the user to be able to download the file rather than have the file displayed in the browser, because the file will include some characters such as tabs and commas....
1
3576
by: a.r.austin | last post by:
Hello, I am trying to download a few files one after another from a remote server. Problem is that I don't know how to, or if I am able at all, set a time out for download. I don't want to time out whole script, just a part if file won't download in 2mins then skip to the next one. Previously, I had a Javascript implementation with AJAX, this time I thought of doing it in PHP since PHP has far better array functions, I don't have to do...
3
2138
by: tshad | last post by:
I have a function that downloads a file to the users computer and it works fine. The problem is that I then want the program to rename the file (file.move) to the same name plus todays date. The problem is that when you run the program it gets to the: Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name)
16
3251
by: matt | last post by:
I have used some free code for listing files for download, but I want to send an email to the administrator when the file has been downloaded. I have got some code in here that does it, but it will not print in the username or email amddress of the person doing the download - which I am collecting from a form on the previous page. I can get the name and email address to print out normally, just not into the email sending body. I have...
0
2173
by: kain razial | last post by:
ANYOTHER NEEDS ALSO CONTACT ME.I WILL HELP YOU TO GET THAT TEKLA XSTEEL V 12 DOWNLOAD LINK. http://www.sendspace.com/file/zem32r
0
4007
by: kain razial | last post by:
ANYOTHER NEEDS ALSO CONTACT ME.I WILL HELP YOU TO GET THAT TEKLA XSTEEL V 12 DOWNLOAD LINK. http://www.sendspace.com/file/zem32r
1
47467
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click on a link and after a moment or two a file download dialog box pops-up in your web browser and prompts you for some instructions, such as open or save. Im going to show you how to do that using a perl script. What You Need Any recent...
0
8738
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9086
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8979
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7829
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6575
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5907
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4667
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3104
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2399
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.