desithugg Posted August 22, 2006 Share Posted August 22, 2006 [code]<?php// get FTP access parameters$host = "sssasdas";$user = "admin@tpfrpg.byethost32.com"$pass = "password"$destDir = "../pics/";$workDir = "/usr/pics/temp"; // define this as per local system// get temporary file name for the uploaded file$tmpName = basename($_FILES['file']['tmp_name']);// copy uploaded file into current directorymove_uploaded_file($_FILES['file']['tmp_name'], $workDir."/".$tmpName) or die("Cannot move uploaded file to working directory");// open connection$conn = ftp_connect($host) or die ("Cannot initiate connection to host");// send access parametersftp_login($conn, $user, $pass) or die("Cannot login");// perform file upload$upload = ftp_put($conn, $destDir."/".$_FILES['file']['name'], $workDir."/".$tmpName, FTP_BINARY);// check upload status// display messageif (!$upload) { echo "Cannot upload";} else { echo "Upload complete";}// close the FTP streamftp_close($conn);// delete local copy of uploaded fileunlink($workDir."/".$tmpName) or die("Cannot delete uploaded file from working directory -- manual deletion recommended");?>[/code] Quote Link to comment Share on other sites More sharing options...
desithugg Posted August 22, 2006 Author Share Posted August 22, 2006 need a lil help with upoloding files with php$host = "localhost";is that right do i put localhost or ftp://aaasas..asdds.comsrry never done this before Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.