Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: HTML XHTML PHP
I have created the following .php form to upload a file to the locally installed XAMP server's FileZilla server.
 
File Upload form
 
 
<html>
<body>
 
<form action="upload_file.php" method="post"
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<input type="submit" name="submit" value="Submit" />
</form>
 
</body>
</html> 
 
 
The following will be the Upload Script.
 
<?php
if ($_FILES["file"]["error"] > 0)
  {
  echo "Error: " . $_FILES["file"]["error"] . "<br />";
  }
else
  {
  echo "Upload: " . $_FILES["file"]["name"] . "<br />";
  echo "Type: " . $_FILES["file"]["type"] . "<br />";
  echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
  echo "Stored in: " . $_FILES["file"]["tmp_name"];
  }
?> 
But my question is how should I give the script to upload the file to the Filezilla server?
Posted 16-Feb-12 6:34am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You can use move_uploaded_file[^] to move the temporary file into the path of the FTP server.
  Permalink  
Comments
Chiranthaka Sampath at 17-Feb-12 5:57am
   
I set the path for the file as the following
$_FILES["file"]["C:\xampp\FileZillaFTP"]$_FILES["file"]["FileZillaFTP"]
 
but both them have given a error like at the below.
 
Notice: Undefined index: C: mpp\FileZillaFTP in C:\xampp\htdocs\Mine\upload_file_script.php on line 20
Stored in:
Graham Breach at 17-Feb-12 6:35am
   
Did you follow the link I posted? There is an example on the page showing what you have to do.
 
Try this:
move_uploaded_file($_FILES['file']['tmp_name'], 'C:\\xampp\\FileZillaFTP\\' . $_FILES['file']['name']);

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 240
1 Kamal Rocks 184
2 BillWoodruff 173
3 Sergey Alexandrovich Kryukov 170
4 PIEBALDconsult 160
0 OriginalGriff 5,695
1 DamithSL 4,506
2 Maciej Los 4,007
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,180


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 16 Feb 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100