LiveWire Network Peer Answers Peer Support Teen Forums Tech Forums College Forums 343 users online 225450 members 510 active today Advertise Here Sign In
TeenCollegeTechPhotos | Quizzes | LiveSecret | Memberlist | Dictionary | News | FAQ
Member Spotlight
daniee
Interests: preforming is my life. i love to ac...
Mood: Flirty
You have 1 new message.
Emergency Help
Until you sign up you can't do much. Yes, it's free.

Sign Up Now
Membername:
Password:
Already have an account?
Invite Friends
Active Members
Groups
Contests
Moderators
1 online / 71 MPM
Fresh Topics
  LiveWire / Technical Forums / Programming & Application Development / Viewing Topic

Downloading files in php
Replies: 5Last Post Sep. 8, 2007 6:58pm by Robert89
Welcome to LiveWire!
We're Stronger Together.
Join the Community
Single page for this topic Email Print Favorite
( pleaseremove )


meh

Patron
Tech Support Leader
Reply
OK, i want to write some code to take an image path and download the file and save it under a filename from a var i set and then allows me to store the full new filename (so including whatever the extension is) so it can be called from my own server.

In other-words, its something to allow me to use images from other sites, but without hot-linking and using their bandwidth. I would rather host locally and then link to them.

Any ideas?

-------
Anyone who isn't confused really doesn't understand the situation
http://craigk.org/pictures/
Can you work out the code?


5:15 pm on Sep. 4, 2007 | Joined: Feb. 2005 | Days Active: 1,303
Join to learn more about pleaseremove England, United Kingdom | Straight Male | Posts: 5,944 | Points: 38,217
LiveWire Humor
Post from this position was omitted due to content violations
The Dalai Lama


Soothsayer

Patron
Reply
Well you can probably just use file_get_contents("http://xyz.com/xyz.jpg";); and then use the fwrite to add it to your server.

5:19 pm on Sep. 4, 2007 | Joined: Oct. 2006 | Days Active: 489
Join to learn more about The Dalai Lama Ontario, Canada | Straight Male | Posts: 8,781 | Points: 12,209
drifting



Patron
Reply
Like have it grab the image and download it, right?

I would like something like that to, it would be useful.

-------
Kids in the back seat can cause accidents.
Accidents in the back seat can cause kids.
Moral: Drive a two seater


5:32 pm on Sep. 4, 2007 | Joined: Jan. 2007 | Days Active: 700
Join to learn more about drifting Indiana, United States | Straight Male | Posts: 17,904 | Points: 31,154
( pleaseremove )


meh

Patron
Tech Support Leader
Reply
Ended up using:
Code:

$new = 'test.jpg';
$old = "http://www.testimage.com/yey.jpg";;
$temp = file_get_contents($old);
$handle = fopen($new, "x");
fwrite($handle, $temp);
fclose($handle);


-------
Anyone who isn't confused really doesn't understand the situation
http://craigk.org/pictures/
Can you work out the code?

6:57 pm on Sep. 4, 2007 | Joined: Feb. 2005 | Days Active: 1,303
Join to learn more about pleaseremove England, United Kingdom | Straight Male | Posts: 5,944 | Points: 38,217
Robert89


Connoisseur

Patron
Reply
Interesting... I may have to use this code. Anybody know how to make it so that a user can upload images directly from their computer onto the web site using PHP? I'm guessing it's probably similar to the above code... so any help would be appreciated.

-------
The difference between genius and stupidity is that genius has its limits.
-- Albert Einstein

6:58 pm on Sep. 8, 2007 | Joined: Sep. 2006 | Days Active: 261
Join to learn more about Robert89 Pennsylvania, United States | Gay Male | Posts: 899 | Points: 6,051
Single page for this topic Email Print Favorite

Quick Reply

You are signed in as our guest.

Looking for something else?
 

  LiveWire / Technical Forums / Programming & Application Development / Viewing Topic