How to Upload a JSP File to the smart FTP?

Problem With FTP File Upload. Invalid Filename Error?

  • Hello, Just now I got an error with my FTP file upload part. I am not able to upload a file via ftp using PHP. the code which I entered is as follows : <?php $conn_id = ftp_connect(localhost); $login_result = ftp_login($conn_id, 'newuser', 'wampp') or die("Could Not Connect To FTP Server"); $image = $_FILES['image']['tmp_name']; $upload = ftp_put($conn_id, 'sri/image.jpg', $image, FTP_ASCII); ?> The error that it shows is as follows : Warning: ftp_put() [function.ftp-put]: Filename invalid in D:\xampp\htdocs\mycloud\edit.php on line 7 Please help me out of this stuff.

  • Answer:

    You should chdir to the sri folder and then do the put command without a folder name.

Maarten Wolzak at Quora Visit the source

Was this solution helpful to you?

Other answers

Is the path to the file sri/ or is it /sri/?  Or is it ../sri/?  Or something else?  If sri isn't a subdirectory of the directory in which the PHP file is running, sri/ doesn't exist.  (It's "the current directory/sri".) ftp_put() takes paths, but the path has to be correct.  Look at comment #3 in the language manual for the function, by  dherran at gmail dot com, for an example. (If you chdir to sri, and it's really ../../sri, the chdir function will be the one that fails.)

Al Klein

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.