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
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
Related Q & A:
- How to delete file that has invalid name?Best solution by Super User
- How to cancel a file upload using an iframe?Best solution by Stack Overflow
- How to use angular-file-upload on a page properly?Best solution by angular-file-upload.appspot.com
- What to do with the error message "Internet explorer has encountered a problem and needs to close?Best solution by Yahoo! Answers
- There was a problem accessing your account. Please try again in a moment. Error #1?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
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.