Click here to Skip to main content
13,045,564 members (70,775 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I have created the following .php form to upload a file to the locally installed XAMP server's FileZilla server.

File Upload form

<form action="upload_file.php" method="post"
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<input type="submit" name="submit" value="Submit" />

The following will be the Upload Script.

if ($_FILES["file"]["error"] > 0)
  echo "Error: " . $_FILES["file"]["error"] . "<br />";
  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 5:34am

1 solution

Rate this: bad
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.
Chiranthaka Sampath 17-Feb-12 5:57am
I set the path for the file as the following
$_FILES["file"]["C:\xampp\FileZillaFTP"]</b and as the following $_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 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
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 16 Feb 2012
Copyright © CodeProject, 1999-2017
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