Jump to content

Upload fail error from script


Recommended Posts

Hi,

 

I have 2 servers. one server runs website, other host files.

assume

website server : server A

File hosting server : server B

 

I have a script that have 2 files

 

index.html  user select a file

 

Content of Index.html :

 

<form enctype="multipart/form-data" action="upload.php" method="post"><br> <input type="hidden" name="MAX_FILE_SIZE" value="30000" /><br> Send this file: <input name="userfile" type="file" /><br> <input type="submit" value="Send File" /><br> </form>

 

upload.php upload the file to server B

 

upload.php file content

 

 <?php
// variables
$ftp_server = "Server B IP";
$ftp_user_name = "Username";
$ftp_user_pass = "password";
$destination_file = "images/".$_FILES['image']['name'];
$sourcefile = $_FILES['image']['name'];

// set up basic connection
$conn_id = ftp_connect($ftp_server); 

// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); 

// check connection
if ((!$conn_id) || (!$login_result)) { 
       echo "FTP connection has failed!";
       echo "Attempted to connect to $ftp_server for user $ftp_user_name"; 
       exit; 
   } else {
       echo "Connected to $ftp_server, for user $ftp_user_name";
   }

// upload the file
$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);  // line 30

// check upload status
if (!$upload) { 
       echo "FTP upload has failed!";
   } else {
       echo "Uploaded $source_file to $ftp_server as $destination_file";
   }

// close the FTP stream 
ftp_close($conn_id);
?> 

 

I get following error when uploading a file.

 

Connected to 173.193.6.194, for user streamer FTP upload has failed!

 

It successfully connect to ftp server, but can not upload the file.

 

Please help me to figure this out.

 

 

More info :

Server A : Hosting server run linux and have parallel Plesk

Server B : windows server 2003 enterprises R2, has IIS, and in IIS i made FTP.

i can connect and upload file to FTP folder using filezilla.

if you need more info to troubleshoot this issue please ask me.

 

Link to comment
https://forums.phpfreaks.com/topic/208139-upload-fail-error-from-script/
Share on other sites

i am trying to make a folder on server B to CMOD 777 using filezilla,

 

i get following error msg :

Command:	SITE CHMOD 777 images
Response:	500 'SITE CHMOD 777 images': command not understood
Status:	Disconnected from server

 

How do i make image folder CHMOD to 777

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.