简体   繁体   中英

FTP upload problem

I have made a program to upload to my NAS via FTP protocol. My program runs fine when I try to upload to my web page, but when I enter the IP of my NAS, the following line returns false:

HINTERNET MyhFtpSession = InternetConnect(MyhInternet, "ftp://89.xxx.xxx.xxx/media", INTERNET_DEFAULT_FTP_PORT, "MyUsername", "MyPassword", INTERNET_SERVICE_FTP, 0, 0);

What is the problem? Is the IP line wrong?

First make sure you can actually connect to the site with FileZilla or something.

Also, what happens if you just put the IP address without the leading "ftp"//" and the trailing "/media" ???

From the documentation for InternetConnect() :

Returns a valid handle to the session if the connection is successful, or NULL otherwise. To retrieve extended error information, call GetLastError() . An application can also use InternetGetLastResponseInfo() to determine why access to the service was denied.

In any case, the call is not returning false . Assuming you meant it returns NULL , then you need to call GetLastError() and/or InternetGetLastResponseInfo() to get the information. You can search for the meaning of the error code in the documentation on system error codes . If you post the result here, then we might be able to help you fix your problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM