Jump to content

upload file using ftp_raw or fsock instead of ftp_put ??


tnen

Recommended Posts

hi

 

i want to upload file using ftp, i found some working code like this

 

<?php

function uploadFile($filename,$filename) {
    	$conn_id = ftp_connect("host");
	ftp_login($conn_id, "user", "pass");
	ftp_put($conn_id, "$file_name", "$filename", FTP_BINARY);
	ftp_quit($conn_id);

	return $file_name;
}

$file_name 		= $_POST['file_name'];
$file_desc 		= str_replace(chr(13),"<br>", $_POST['file_desc']);
$filename		= $_FILES['FILENAME']['tmp_name'];
$filename_name 	= $_FILES['FILENAME']['name'];
$filename_type	= $_FILES['FILENAME']['type'];
$filename_size	= $_FILES['FILENAME']['size'];

$file_source	= uploadFile($filename,$filename_name);

?>

 

but the problem that i want to read the server response as ftp clients show

 

COMMAND:>	[01/02/2008 04:48:33 م] CWD /cadpic.gif
	[01/02/2008 04:48:33 م] 550 /cadpic.gif: No such file or directory
STATUS:>  	[01/02/2008 04:48:33 م] Requested action not taken (e.g., file or directory not found, no access).
COMMAND:>	[01/02/2008 04:48:33 م] CWD /
	[01/02/2008 04:48:34 م] 250 CWD command successful
STATUS:>  	[01/02/2008 04:48:34 م] PWD skipped. Current folder: "/".
COMMAND:>	[01/02/2008 04:48:34 م] PASV
	[01/02/2008 04:48:34 م] 227 Entering Passive Mode (00,000,00,00,223,133).
COMMAND:>	[01/02/2008 04:48:34 م] STOR cadpic.gif
STATUS:>  	[01/02/2008 04:48:34 م] Connecting FTP data socket... 00.000.00.00:57221...
	[01/02/2008 04:48:38 م] 150 Opening BINARY mode data connection for cadpic.gif
	[01/02/2008 04:48:44 م] 226 Transfer complete.

 

ftp_raw returns this response but i couldn't use it to upload files ?? how can i do it or is there any better way to upload ang get the response?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.