PHP File Upload

Hello PHP Experts,

is there any way to upload a file using PHP from a Remote Server? for Example I would upload a file from another Server (ftp or Http) to my server.

k4hvd77
LVL 4
k4hvd77Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
venkateshwarrConnect With a Mentor Commented:
try this...

<?php
$userfile="http://www.google.com/index.html";
$copyfile="index.html";
if(file_exists($userfile)) { echo "File already exists"; }
else
{
copy($userfile,$copyfile);
print "File downloaded";
}
?>

0
 
venkateshwarrCommented:
why dont you write a script to download the file to your server.
Whatever php you write will run on the server itself..
0
 
k4hvd77Author Commented:
I have no experience with php!  Could you send me some Examples how to do something Like that?


k4hvd77
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
k4hvd77Author Commented:
got following:

Warning: copy(index.html): failed to open stream: Permission denied in /home/k4hvd/public_html/PHPDocument1.php on line 7
File downloaded
0
 
venkateshwarrCommented:
your directory does not have write permissions...
0
 
k4hvd77Author Commented:
thank you venkateshwarr,

I have just 2 other questions ( 125 points Extra),

- How to do it by postnig Data? for example (downloadfile.php?filename=http://www.google.com/index.html&Saveto=index.html )

- I would know how Long does it take to download the file ( for example 0,001 seconds )


0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.