Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
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 6: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 at 17-Feb-12 5:57am
I set the path for the file as the following
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 Maciej Los 580
1 OriginalGriff 420
2 Sascha Lefévre 289
3 Abhinav S 220
4 CHill60 200
0 Sergey Alexandrovich Kryukov 9,773
1 OriginalGriff 9,290
2 Peter Leow 5,137
3 Kornfeld Eliyahu Peter 3,373
4 Maciej Los 3,036

Advertise | Privacy | Mobile
Web03 | 2.8.150327.1 | Last Updated 16 Feb 2012
Copyright © CodeProject, 1999-2015
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