Re: best" upload method

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

 



If the destination for the uploaded file is on the same host as the web server, it will be several orders of magnitude faster to use the first method (move_uploaded_file()). Of course, you may have to reorganize your permissions to allow the web-server to write to the destination directory. If the destination for the uploaded file is on a remote server, you must use the second option, unless you want to get fancy and use NFS or something which allows the first method to function transparently.

With my limted knowledge (limited meaning "none") of your setup, I would recommend the first method for speed, ease of implementation, and reliability (what if the FTP server goes down?). If you cannot configure your file system permissions to allow the web server to write to the destination directory, then use the FTP option. Keep in mind that it is *very* slow to initiate an FTP transation, upload the file (to the same machine!) and then close the connection. Copying a file locally will be much faster, and probably more reliable.

Good luck.

--Dave

open-mind wrote:

Sorry but I didn't know which is the name of the first method
I will rephrase
which is the best method to upload a file to server ??

this:
//////
$result =
move_uploaded_file($HTTP_POST_FILES['img_6']["tmp_name"],"dir/filename.jpg")
;
$result = $result ? "OK":"NOT OK";
print $result;
////

or ... this:
/////
$conn_id = ftp_connect("$ftp_server");
$upload = ftp_put($conn_id, "$destination_file", "$source_file",
FTP_BINARY);
ftp_quit($conn_id);
////

how depends on the application ?

----- Original Message -----
From: "David Smith" <DavidSmith@byu.net>
To: "open-mind" <open-mind@home.ro>
Cc: <php-db@lists.php.net>
Sent: Friday, September 12, 2003 9:04 PM
Subject: Re:  best" upload method




which is the "best" upload file method ?
file uploads or FTP commands from PHP


Now that's the most open ended question I've read all day. Here, flip a
coin. If it falls heads, FTP. If it falls tails, the other one. Even
still, I'm not sure I understand the question: File uploads or FTP command
from PHP? One of your options is just the question restated...

Regardless and all sarcasm aside, this question depends seriously on the
application.

:)

--Dave








-- 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