upload a file from the web using PHP

Post Reply
User avatar
Rksk
Major
Major
Posts: 730
Joined: Thu Jan 07, 2010 4:19 pm
Location: Rathnapura, Sri Lanka

upload a file from the web using PHP

Post by Rksk » Thu Apr 08, 2010 9:03 am

How to upload a file from the web using PHP?
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: upload a file from the web using PHP

Post by Neo » Thu Apr 08, 2010 9:32 am

User avatar
Rksk
Major
Major
Posts: 730
Joined: Thu Jan 07, 2010 4:19 pm
Location: Rathnapura, Sri Lanka

Re: upload a file from the web using PHP

Post by Rksk » Thu Apr 08, 2010 10:15 am

I want to download a file from a remote web server!
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: upload a file from the web using PHP

Post by Neo » Thu Apr 08, 2010 12:31 pm

First post is,
How to upload a file from the web using PHP?
.

The next is,
I want to download a file from a remote web server!
.

Are you talking about the same question? If that is the case, I don't understand. Be descriptive... Do not put me on trying to figure out what you want.

If that is not the case, then you need to start a new topic for a different question.
User avatar
Rksk
Major
Major
Posts: 730
Joined: Thu Jan 07, 2010 4:19 pm
Location: Rathnapura, Sri Lanka

Re: upload a file from the web using PHP

Post by Rksk » Thu Apr 08, 2010 3:34 pm

That is my question,

I want to copy a file from a website to my server using PHP ?

I said it as "uploading from the Web" because at the changing ROBOT.LK user avatar we can upload a image from PC or from the Web. :mrgreen: :mrgreen: :mrgreen:
User avatar
Rksk
Major
Major
Posts: 730
Joined: Thu Jan 07, 2010 4:19 pm
Location: Rathnapura, Sri Lanka

Re: upload a file from the web using PHP

Post by Rksk » Fri Apr 09, 2010 7:22 am

Code: Select all

<?php
if(!@copy('http://someserver.com/somefile.zip','./somefile.zip'))
{
    $errors= error_get_last();
    echo "COPY ERROR: ".$errors['type'];
    echo "<br />\n".$errors['message'];
} else {
    echo "File copied from remote!";
}
?> 
User avatar
Neo
Site Admin
Site Admin
Posts: 2642
Joined: Wed Jul 15, 2009 2:07 am
Location: Colombo

Re: upload a file from the web using PHP

Post by Neo » Fri Apr 09, 2010 5:51 pm

This is the talent of Sri Lanka... Simple, but an excellent job.
Mysoogal
Captain
Captain
Posts: 223
Joined: Thu Dec 17, 2009 7:15 am
Location: Planet VPS

Re: upload a file from the web using PHP

Post by Mysoogal » Wed Apr 21, 2010 5:35 am

great ! now my video encoding application can have remote upload possibility :D thanks
Post Reply

Return to “PHP & MySQL”