Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
5Activity
0 of .
Results for:
No results containing your search query
P. 1
Proses Upload and Download File

Proses Upload and Download File

Ratings: (0)|Views: 398 |Likes:
Published by wasis85

More info:

Published by: wasis85 on Aug 10, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

12/06/2012

pdf

text

original

 
UPLOAD AND DOWNLOAD FILEUSING PHP SCRIPT AND SERVER PHPTRIAD VIA FTP SERVER 
Pada system komputerisasi yang menggunakan jaringansering kali kita diharuskan untuk melakukan proses uploadand download file yang ada pada file server. Untukmelakukan hal tersebut ada beberapa konfigurasi yang dapatdilakukan, diantaranya adalah konfigurasi phptriadnyadengan cara :1.
 
Install PHPTRIAD sampai proses instalasi selesai.2.
 
Buka file php.ini pada folder c:/apache/php/php.ini.Ubah baris post_max_size = 200M. Ini dimaksudkan agarfile yang dapat diupload bisa sebesar 200M.3.
 
Aktifkan server apache.Untuk dapat mengupload dan mendownload filemenggunakan script php harus menggunakan syntax yang adapada php itu sendiri. Script – script itu sendiri sayadapatkan pada webhttp://id2.php.net.1.
 
Untuk proses upload kita dapat menggunakan perintahftp_put, scriptnya adalah :
ftp_put
( resource $ftp_stream , string$remote_file , string $local_file , int $mode [,int $startpos ] )Keterangan :
ftp_stream 
:
The link identifier of the FTPconnection.
remote_file
:
The remote file path.
local_file
:
The local file path.
 
 mode
:
The transfer mode. Must be either
FTP_ASCII
or
FTP_BINARY
.
startpos
 Contoh Script php :
<?php$file='somefile.txt'; $remote_file='readme.txt'; // set up basic connection$conn_id=ftp_connect($ftp_server); // login with username and password$login_result=ftp_login($conn_id,$ftp_user_name,$f tp_user_pass);// upload a fileif (ftp_put($conn_id,$remote_file,$file,FTP_ASCII)) {echo"successfully uploaded $file\n";} else {echo"There was a problem while uploading $file\n";}// close the connectionftp_close($conn_id); ?>2.
 
Untuk Proses Download saya menggunakan ftp_get,sintaknya adalah :
ftp_get
( resource $ftp_stream , string$local_file , string $remote_file , int $mode [,int $resumepos ] )
 
Keterangan :
ftp_stream 
:
The link identifier of the FTPconnection.
local_file
:
The local file path (will beoverwritten if the file already exists).
remote_file
:
The remote file path.
 mode
:
The transfer mode. Must be either
FTP_ASCII
or
FTP_BINARY
.
resumepos
:
The position in the remote file tostart downloading from.
Contoh Script PHP :
<?php// define some variables$local_file='local.zip'; $server_file='server.zip'; // set up basic connection$conn_id=ftp_connect($ftp_server); // login with username and password$login_result=ftp_login($conn_id,$ftp_user_name,$f tp_user_pass);// try to download $server_file and save to $local_fileif (ftp_get($conn_id,$local_file,$server_file,FTP_B INARY)) {echo"Successfully written to $local_file\n";} else {echo"There was a problem\n";

Activity (5)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
Abdul Gafur liked this
sand_the_end liked this

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->