大网数据广告活动
Web服务器与PHP

FtpPutFile always returns success

· 52CE 我爱测

This article provides resolutions for the problem where the WinInet FtpPutFile returns TRUE even when the operation fails with 451 status.

This article helps you resolve the problem where the Windows Internet (WinINet) FtpPutFile function still returns TRUE even when the operation fails with the 451 status.

Original product version:   Internet Explorer 10, 9
Original KB number:   2790777

Symptoms

The Wininet.dll FtpPutFile API returns TRUE even when the operation fails with the following status:

451 - Requested action aborted: local error in processing.

The sequence of events leading up to this result is similar to the following:

FTP:Response to Port 28376, '230 Login successful.'
FTP:Response to Port 28376, '200 Switching to ASCII mode.'
FTP:Request from Port 28376, 'PASV'
FTP:Response to Port 28376, '227 Entering Passive Mode (192,168,0,99,213,154).'
FTP:Request from Port 28376,'STOR myTesting.txt'
FTP:Response to Port 28376, '150 Ok to send data.'
(Now data is sent to 192,168,0,99 with port 256x213+154 = 54682)
FTP:Response to Port 28376, '451 Failure writing to local file.'

Cause

The WinINet FtpPutFile function (including both FtpPutFileA and FtpPutFileW) reports the status code as TRUE even though the internal WinINet implementation of FtpPutFile function already captured the 451 Failure writing to local file error response from the server.

Workaround

To work around this issue, check the return status code of FtpPutFile instead of relying on the API returning False. To achieve this, you can use the InternetGetLastResponseInfo() function to check the Server-Response.

Note: The FTP protocol can return additional text information along with most errors. This extended error information can be retrieved by using the InternetGetLastResponseInfo function.

Source: Microsoft Learn / IT Pro troubleshooting by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / IT Pro troubleshooting
适用范围
See source applicability · Source date 03/23/2020
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。