php form upload via permission 777, permissions 755 suphp, or ftp? -


looking opinions on best?

upload through form 777 directory.

upload through form 775 directory using suphp.

upload through form directory using ftp.

-- file through ftp example-- way folder doesnt have write apache; more secure

$fp = fopen($_files['file'], 'r'); $conn_id = ftp_connect($ftp_server); $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); ftp_fput($conn_id, $file, $fp, ftp_ascii); ftp_close($conn_id); fclose($fp); 

you should uploading file directory apache has write permissions on, not on internet. apache should have write permissions default on shared hosting services.

if have own server there several command lines can run give apache write permissions upload directories. i'm not going go specific ones since varies operating system.

as actual uploading want submit file part of form script. i'm going use php:

$file = $_files["get/post name"]; <- file move_uploaded_file($file, "wherever/you/want/"); <- moves tmp file directory of choice. should relative document root.  

don't forget last / or put file in 'you' folder name want(yourname).extension


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -