Re: Copying an image from one server to another

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

 



I was unsure what was meant by FILE in php - is that the global? How do I reference a remote site's jpg file into FILE? Then how to I create the output from the php into stdout - using the return of a function? or print? Then how to launch rsynch - I understand how to call it from cron, as my web server kindly gives me an interface for this, but to create the file I would need to know what extension to save with the script name, and how to make it execute, ie the equivalent of <?php for rsynch scripts. Then how is FILE read by rsynch script. So lots more questions just to copy a publicly available image into my site. There has got to be an easier way.

John

Mr Webber wrote:
Note the rsync option:

--include-from=FILE
       This  option  is  related  to  the --include option, but it specifies
a FILE that contains include patterns (one per line).  Blank
       lines in the file and lines starting with ';' or '#' are ignored.  If
FILE is -, the list will be read from standard input.

So, from a PhpScript, you manage the contents of "FILE" and then launch
rsync with the appropriate additional options.

-----Original Message-----
From: ioannes [mailto:ioannes@xxxxxxxxxxxxxx] Sent: Monday, February 04, 2008 12:59 PM
To: php-db@xxxxxxxxxxxxx
Subject: Re:  Copying an image from one server to another

Initially I could not find much on SCP and rsynch is about synchronising folders, but that is only part of the problem. I don't want files in the target location that are not referenced from the target database. I hold references like this

img[]=pic1.jpg&img[]=pic2.jpg

then I parse it out into the img array. So I want to do it from php programming and am on a shared server. I may have access to the terminal for linux/unix but I am not too strong in that area. So am I wrong to be still thinking of cURL?

John

Aleksandar Vojnovic wrote:
How about sending the file via SCP? (it would be a much more safer to transfer files)

-Aleksander

Chris wrote:
ioannes wrote:
I am trying to:

- check whether an image file exists on a server,
- check whether it does not exist on another server, and if not exists
- to copy from the first location to the second.

I am using cURL. First step to capture the image from the first server. When I return this image to the browser I get a lot of strange characters. So has this captured the image and what do I use next to upload to the second server?

I was trying to use file_exists and had problems referencing the file location as "http://wwww.mysite.com/pic.jpg";. But I know I can also look at using readfile() and file_put_contents(), $fp = fopen(), fputs(), fpassthru() etc. What is best way?
FTP.

There's no way fopen is going to be able to write to a remote url, that'd just be such a huge security issue it's not funny.



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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux