일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- flutter 실행하기
- page navigation
- 플러터
- StoreKit
- 정규식 문자치환
- SKStoreReviewController
- flutter 환경설정
- flutter 앱 만들기
- 검색구현
- ftp download
- php ftp upload
- flutter 총정리
- 문자치환
- regexp
- 크기 리사이즈
- android function
- db connect
- Review
- php
- php 게시판
- flutter 완벽 가이드
- flutter getting started
- ftp연동
- Flutter 설치
- AppStore
- flutter 설치하기
- ftp upload
- php 문자치환
- Swift
- php ftp download
- Today
- Total
AppleTree iOS
FTP연동 upload하기 본문
# ftp_upload.php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>ftp upload</title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<body>
<h1>ftp upload</h1>
<?php
$host = '본인 FTP주소';
$user = '본인 USER 아이디';
$password = '본인 비밀번호';
$remotefile = '/html/a.jpg';
$localfile = './a.jpg';
$conn = @ftp_connect($host);
if(!$conn){
echo "error:Could not connect to ftp server<br>";
exit;
}
echo "Connected to $host<br>";
$result = @ftp_login($conn,$user,$password);
if(!$result){
echo "error:Could not log on as $user<br>";
ftp_quit($conn);
exit;
}
echo "Logged in as $user<br>";
ftp_pasv($conn,true);
echo "Checking file time... <br>";
if(@file_exists($localfile)){
$localtime = filemtime($localfile);
echo "local file last updated";
echo date('G:i j-M-Y',$localtime);
echo '<br>';
}else{
$localtime = 0;
}
$remotetime = ftp_mdtm($conn,$remotefile);
if(!($remotetime >= 0)){
echo "can't access remote file time.<br>";
$remotetime = $localtime + 1;
}else{
echo "remote file last updated";
echo date('G:i j-M-Y',$remotetime);
echo "<br>";
}
if(!($remotetime > $localtime)){
echo "local copy is up to date.<br>";
exit;
}
echo "Pushing file to server...<br>";
if(!$success = ftp_put($conn,$remotefile,$localfile,FTP_BINARY)){
echo "Error : Could not upload file";
ftp_quit($conn);
exit;
}
echo "File uploaded successfully";
ftp_quit($conn);
?>
</body>
</html>
'PHP > PHP로 FTP만들기' 카테고리의 다른 글
FTP연동 download (0) | 2013.07.11 |
---|