當前位置:首頁 » 文件管理 » netftp文件上傳

netftp文件上傳

發布時間: 2025-04-15 00:41:41

㈠ C# ASP.net ftp上傳功能本地編譯沒問題,網站發布後通過網址訪問再用此功能報404錯誤

404 錯誤意味著鏈接指向的網頁不存在,即原始網頁的URL失效,這種情況經常會發生,很難避免,比如說:網頁URL生成規則改變、網頁文件更名或移動位置、導入鏈接拼寫錯誤等,導致原來的URL地址無法訪問;當Web 伺服器接到類似請求時,會返回一個404 狀態碼,告訴瀏覽器要請求的資源並不存在。
導致這個錯誤的原因一般來說,有三種:

1、無法在所請求的埠上訪問Web站點。

2、Web服務擴展鎖定策略阻止本請求。

3、MIME映射策略阻止本請求。
解決辦法:
1. 對於存在的網頁內容由於路徑改變而導致訪問不了時,可在IIS 中定義404錯誤指向一個動態頁面,在頁面裡面使用301永久重定向跳轉到新的地址,此時伺服器返回301狀態碼。

2、設置404指向一個設計好的html文件,
此時頁面返回的404狀態碼。
idc提供商基本都提供404設置的功能,直接上傳文件設置即可。在IIs中設置方法:打開IIS管理器-->點擊要設置自定義404的網站的屬性
-->點擊自定義錯誤選項-->選中404頁-->選中並打開編輯屬性-->設置成 URL --> URL
里填寫「/err404.html」-->按確定退出再把做好的err404.html
頁面上傳到網站根目錄下。此處在「消息類型」中一定要選擇「文件」或「默認值」,而不要選擇「URL」,不然,將導致返回「200」狀態碼。

3、404指向一個動態頁面,
比如error.asp,如果不在頁面裡面進行設置,僅僅是返回提示的HTML 代碼,將導致頁面返回200
狀態碼,這是不正確的,我們可以在顯示完提示內容後,增加語句: Response.Status="404 Not Found"
,這樣就保證頁面返回404狀態碼。

4、Apache下設置404錯誤頁面。為Apache Server設置404錯誤頁面的方法很簡單,只需在.htaccess 文件中加入如下內容即可,ErrorDocument 404 /notfound.php

㈡ FTP上傳文件錯誤

150 opening ascii mode data connection for /bin/ls.
426 data connection closed, transfer aborted.

這種情況可能是你所在網路安裝了防火牆(或代理),該防火牆(或代理)禁止來自遠程的連接,426 data connection closed, transfer aborted表明了這一點。這時候你可以使用被動傳輸模式(pasv模式),來避免該限制,進行數據傳輸.
解決辦法是在該ftp標簽的站點設置中,設置為被動模式pasv模式.同樣,如果前面有網友出現200 port command successful.
連不上的情況,也用上面方法

1.
connected. waiting for response.
220 serv-u ftp server v4.0 for winsock ready...
user anonymous
530 sorry, no anonymous access allowed.
quit
不允許匿名登錄

2.

connected. waiting for response.
220 serv-u ftp server v4.0 for winsock ready...
user test
331 user name okay, need password.
pass xxxxxx
530 not logged in.
quit
一般是密碼輸入錯誤時出現的信息。密碼不對喲!

3.
connecting to xxx.xxx.xxx.xxx, port 21 (#1)
error: connection timed out

這個表明對方未開機,也可能是對方不在你能訪問的范圍內。可能小區的伺服器檢修中。

4.

connecting to xxx.xxx.xxx.xxx port 21 (#1)
error: connection refused
這個一般表明對方已開機,但未開啟ftp服務(沒有開serv-u)
也可能為對方不提供在這個埠上的服務

5.

connecting to xxx.xxx.xxx.xxx, port 21 (#1)
connected. waiting for response.
disconnected from server.
connection attempt failed. waiting for retry...
出現這個信息實在是很倒霉,你極有可能把重試時間定的太短伺服器封了你喲!

6.
connecting to xxx.xxx.xxx.xxx, port 21 (#1)
connected. waiting for response.
user xxx
331 user name okay, need password
pass xxxxxx
530 not logged in, unauthorized ip address.
quit
沒有登記ip!或者登記的ip和你現在下載的不一樣!趕快重新登記吧!

7.
227 entering passive mode (218,3,87,224,10,232)
retr hfdx-tsoaf.sub.rar
550 sorry, insufficient credit for download - upload first.
傳輸已失敗!
傳輸隊列已完成
你的流量不夠了,重新購買吧!

8.
connected. waiting for response.
220 serv-u ftp server v4.0 for winsock ready...
user user
421 too many users - please try again later.
說明當前你所屬的下載組的下載人數已到上限,請過些時候再嘗試,用Flashget等的下載工具不斷嘗試聯接的人請講嘗試時間調大一點,否則會被伺服器封閉一段時間的IP

9.
150 opening ascii mode data connection for /bin/ls.
426 data connection closed, transfer aborted.

這種情況可能是你所在網路安裝了防火牆(或代理),該防火牆(或代理)禁止來自遠程的連接,426 data connection closed, transfer aborted表明了這一點。這時候你可以使用被動傳輸模式(pasv模式),來避免該限制,進行數據傳輸.
解決辦法是在該ftp標簽的站點設置中,設置為被動模式pasv模式.同樣,如果前面有網友出現200 port command successful.
連不上的情況,也用上面方法

Connecting to xxx.xxx.xxx.xxx, Port 21 (#1)
ERROR: Connection timed out
這個表明對方未開機,也可能是對方不在你能訪問的范圍內
-----------------------------------
Connecting to xxx.xxx.xxx.xxx Port 21 (#1)
ERROR: Connection refused
這個一般表明對方已開機,但未開啟FTP服務(沒有開Serv-U)
也可能為對方不提供在這個埠上的服務
-----------------------------------
Connecting to xxx.xxx.xxx.xxx, Port 21 (#1)
Connected. Waiting for response.
Disconnected from server.
Connection attempt failed. Waiting for retry...
出現這個信息實在是很倒霉,你極有可能被對方Ban了。
如果只是Ban幾分鍾or幾小時or一天還好,不然只有和站長說說好話,讓他給你解封吧。

-----------------------------------
110 Restart marker reply. In this case, the text is exact and not left to
the particular implementation; it must read: MARK yyyy = mmmm where yyyy is
User-process data stream marker, and mmmm server s equivalent marker (note
the spaces between markers and "=").
重新啟動標志回應。這種情況下,信息是精確的並且不用特別的處理;可以這樣看:標記 yyyy = mmm 中 yyyy是 用戶進程數據流標記,mmmm是伺服器端相應的標記(注意在標記和等號間的空格)
-----------------------------------
120 Service ready in nnn minutes.
服務在NNN時間內可用
-----------------------------------
125 Data connection already open; transfer starting.
數據連接已經打開,開始傳送數據.
-----------------------------------
150 File status okay; about to open data connection.
文件狀態正確,正在打開數據連接.
-----------------------------------
200 Command okay.
命令執行正常結束.
-----------------------------------
202 Command not implemented, superfluous at this site.
命令未被執行,此站點不支持此命令.
-----------------------------------
211 System status, or system help reply.
系統狀態或系統幫助信息回應.
-----------------------------------
212 Directory status.
目錄狀態信息.
-----------------------------------
213 File status.
文件狀態信息.
-----------------------------------
214 Help message.On how to use the server or the meaning of a particular
non-standard command. This reply is useful only to the human user. 幫助信息。
關於如何使用本伺服器或特殊的非標准命令。此回復只對人有用。
-----------------------------------
215 NAME system type. Where NAME is an official system name from the list
in the Assigned Numbers document.
NAME系統類型。
-----------------------------------
220 Service ready for new user.
新連接的用戶的服務已就緒
-----------------------------------
221 Service closing control connection.
控制連接關閉
-----------------------------------
225 Data connection open; no transfer in progress.
數據連接已打開,沒有進行中的數據傳送
-----------------------------------
226 Closing data connection. Requested file action successful (for example,
file transfer or file abort).
正在關閉數據連接。請求文件動作成功結束(例如,文件傳送或終止)
-----------------------------------
227 Entering Passive Mode (h1,h2,h3,h4,p1,p2).
進入被動模式
-----------------------------------
230 User logged in, proceed. Logged out if appropriate.
用戶已登入。 如果不需要可以登出。
-----------------------------------
250 Requested file action okay, completed.
被請求文件操作成功完成
-----------------------------------
257 "PATHNAME" created.
路徑已建立
-----------------------------------
331 User name okay, need password.
用戶名存在,需要輸入密碼
-----------------------------------
332 Need account for login.
需要登陸的賬戶
-----------------------------------
350 Requested file action pending further information
對被請求文件的操作需要進一步更多的信息
-----------------------------------
421 Service not available, closing control connection.This may be a reply
to any command if the service knows it must shut down.
服務不可用,控制連接關閉。這可能是對任何命令的回應,如果服務認為它必須關閉
421 Too many users - please try again later.
太多用戶,那就過會再連
-----------------------------------
425 Can t open data connection.
打開數據連接失敗
-----------------------------------
426 Connection closed; transfer aborted.
連接關閉,傳送中止。
-----------------------------------
450 Requested file action not taken.
對被請求文件的操作未被執行
-----------------------------------
451 Requested action aborted. Local error in processing.
請求的操作中止。處理中發生本地錯誤。
-----------------------------------
452 Requested action not taken. Insufficient storage space in system.File
unavailable (e.g., file busy).
請求的操作沒有被執行。 系統存儲空間不足。 文件不可用
-----------------------------------
500 Syntax error, command unrecognized. This may include errors such as
command line too long.
語法錯誤,不可識別的命令。 這可能是命令行過長。
-----------------------------------
501 Syntax error in parameters or arguments.
參數錯誤導致的語法錯誤
-----------------------------------
502 Command not implemented.
命令未被執行
-----------------------------------
503 Bad sequence of commands.
命令的次序錯誤。
-----------------------------------
504 Command not implemented for that parameter.
由於參數錯誤,命令未被執行
-----------------------------------
530 Not logged in.
一般來說是密碼錯誤。
530 Sorry, no ANONYMOUS access allowed.
這個就是不許匿名登錄
530 Not logged in, unauthorized IP address
這個有點麻煩,你的IP不在站長允許訪問的IP范圍內,只有和站長聯系,讓他把你的IP網段加入Allow Access列表裡吧
530 Not logged in, only one(也有可能是two or three) session from same IP allowed at a time.
每個IP只能開一個(也有可能是two or three) 下載,就不要用多線程啦,小心Ban了你。
-----------------------------------
532 Need account for storing files.
存儲文件需要賬戶信息
-----------------------------------
550 Requested action not taken. File unavailable (e.g., file not found, no
access).
請求操作未被執行,文件不可用。
-----------------------------------
551 Requested action aborted. Page type unknown.
請求操作中止,頁面類型未知
-----------------------------------
552 Requested file action aborted. Exceeded storage allocation (for current
directory or dataset).
對請求文件的操作中止。 超出存儲分配
-----------------------------------
553 Requested action not taken. File name not allowed
請求操作未被執行。 文件名不允許
-----------------------------------
這種錯誤跟http協議類似,大致是:
2開頭--成功
3開頭--許可權問題
4開頭--文件問題
5開頭--伺服器問題

㈢ C#.net 上傳文件到FTP

可以利用 C# FTP上傳類上傳

publicclassFtpWeb
{
stringftpServerIP;
stringftpRemotePath;
stringftpUserID;
stringftpPassword;
迅春stringftpURI;

///<summary>
///連接FTP
///</summary>
///<paramname="FtpServerIP">FTP連接地址</param>
///<paramname="FtpRemotePath">指定FTP連接成功後的當前目錄,如果不指定即默認為根目錄</param>
///<paramname="FtpUserID">用戶名</param>
///<paramname="FtpPassword">密碼</param>
publicFtpWeb(stringFtpServerIP,stringFtpRemotePath,stringFtpUserID,stringFtpPassword)
{
ftpServerIP=FtpServerIP;
ftpRemotePath=FtpRemotePath;
ftpUserID=FtpUserID;
ftpPassword=FtpPassword;
ftpURI="ftp://"+ftpServerIP+"/"+ftpRemotePath+"/";
}

///<summary>
///上傳
///</summary>
///<paramname="filename"></param>
畝歲耐publicvoidUpload(stringfilename)
{
FileInfofileInf=newFileInfo(filename);
stringuri=ftpURI+fileInf.Name;
FtpWebRequestreqFTP;

reqFTP=(FtpWebRequest)FtpWebRequest.Create(newUri(uri));
reqFTP.Credentials=雀顫newNetworkCredential(ftpUserID,ftpPassword);
reqFTP.KeepAlive=false;
reqFTP.Method=WebRequestMethods.Ftp.UploadFile;
reqFTP.UseBinary=true;
reqFTP.ContentLength=fileInf.Length;
intbuffLength=2048;
byte[]buff=newbyte[buffLength];
intcontentLen;
FileStreamfs=fileInf.OpenRead();
try
{
Streamstrm=reqFTP.GetRequestStream();
contentLen=fs.Read(buff,0,buffLength);
while(contentLen!=0)
{
strm.Write(buff,0,contentLen);
contentLen=fs.Read(buff,0,buffLength);
}
strm.Close();
fs.Close();
}
catch(Exceptionex)
{
Insert_Standard_ErrorLog.Insert("FtpWeb","UploadError-->"+ex.Message);
}
}
}

㈣ 如何漢化net2ftp

在\files_to_upload裡面找到settings.inc.php,這個是配置文件,用記事本打開它,我們來進行簡單的設置。找到
$net2ftp_settings["default_language"] = "en";(默認的語言英語,漢語版本有問題,不建議使用)
$net2ftp_settings["default_skin"] ; ; ; ;= "india";(皮膚,建議改成blue,因為這個皮膚做的很完美)
$net2ftp_settings["admin_username"] = "admin";(默認的管理員名稱,可以修改)
$net2ftp_settings["admin_password"] = "";(默認為空,如果你要記錄程序使用日誌,添加密碼即可)
$net2ftp_settings["max_upload_filesize"] ; ;= "2000000"; ; ;(文件最大上傳大小,默認2M,根據需要修改)
$net2ftp_settings["use_database"] = "no"; (是否記錄登陸日誌,默認NO,可修改為YES,別忘了把create_tables.sql導入到你的MySQL裡面)
// Enter your MySQL settings(這里的幾個要在上面那個選項為YES時填寫)
$net2ftp_settings["dbusername"] = "";用戶名
$net2ftp_settings["dbpassword"] = "";密碼
$net2ftp_settings["dbname"] ; ; ; ;= "";資料庫
$net2ftp_settings["dbserver"] ; ;= "localhost"; 地址
$net2ftp_settings["max_consumption_ipaddress_dataTransfer"] = 20000000; // 每個IP每天最多傳輸文件位元組$net2ftp_settings["max_consumption_ftpserver_dataTransfer"] =50000000; // 每個FTP伺服器最多接受位元組

㈤ VB.net連接FTP操作

MSDN上的,看看對你有沒有幫助。GOOD LUCK!

Imports System.Net
Imports System.IO

Mole FtpSample

Sub Main(ByVal args() As String)
If args.Length = 0 OrElse args(0).Equals("/?") Then
DisplayUsage()
ElseIf args.Length = 1 Then
Download(args(0))
ElseIf args.Length = 2 Then
If args(0).Equals("/list") Then
List(args(1))
Else
Upload(args(0), args(1))
End If
Else
Console.WriteLine("Unrecognized argument.")
End If
End Sub

Private Sub DisplayUsage()
Console.WriteLine("USAGE:")
Console.WriteLine(" FtpSample [/? | <FTP download URL> | <local file>")
Console.WriteLine(" <FTP upload URL> | /list <FTP list URL>]")
Console.WriteLine()
Console.WriteLine("where")
Console.WriteLine(" FTP download URL URL of a file to download from an FTP server.")
Console.WriteLine(" FTP upload URL Location on a FTP server to upload a file to.")
Console.WriteLine(" FTP list URL Location on a FTP server to list the contents of.")
Console.WriteLine(" local file A local file to upload to an FTP server.")
Console.WriteLine()
Console.WriteLine(" Options:")
Console.WriteLine(" /? Display this help message.")
Console.WriteLine(" /list Specifies the list command.")
Console.WriteLine()
Console.WriteLine("EXAMPLES:")
Console.WriteLine(" Download a file FtpSample ftp://myserver/download.txt")
Console.WriteLine(" Upload a file FtpSample upload.txt ftp://myserver/upload.txt")
End Sub

Private Sub Download(ByVal downloadUrl As String)
Dim responseStream As Stream = Nothing
Dim fileStream As FileStream = Nothing
Dim reader As StreamReader = Nothing
Try
Dim downloadRequest As FtpWebRequest = _
WebRequest.Create(downloadUrl)
Dim downloadResponse As FtpWebResponse = _
downloadRequest.GetResponse()
responseStream = downloadResponse.GetResponseStream()

Dim fileName As String = _
Path.GetFileName(downloadRequest.RequestUri.AbsolutePath)

If fileName.Length = 0 Then
reader = New StreamReader(responseStream)
Console.WriteLine(reader.ReadToEnd())
Else
fileStream = File.Create(fileName)
Dim buffer(1024) As Byte
Dim bytesRead As Integer
While True
bytesRead = responseStream.Read(buffer, 0, buffer.Length)
If bytesRead = 0 Then
Exit While
End If
fileStream.Write(buffer, 0, bytesRead)
End While
End If
Console.WriteLine("Download complete.")
Catch ex As UriFormatException
Console.WriteLine(ex.Message)
Catch ex As WebException
Console.WriteLine(ex.Message)
Catch ex As IOException
Console.WriteLine(ex.Message)
Finally
If reader IsNot Nothing Then
reader.Close()
ElseIf responseStream IsNot Nothing Then
responseStream.Close()
End If
If fileStream IsNot Nothing Then
fileStream.Close()
End If
End Try
End Sub

Private Sub Upload(ByVal fileName As String, ByVal uploadUrl As String)
Dim requestStream As Stream = Nothing
Dim fileStream As FileStream = Nothing
Dim uploadResponse As FtpWebResponse = Nothing
Try
Dim uploadRequest As FtpWebRequest = WebRequest.Create(uploadUrl)
uploadRequest.Method = WebRequestMethods.Ftp.UploadFile

' UploadFile is not supported through an Http proxy
' so we disable the proxy for this request.
uploadRequest.Proxy = Nothing

requestStream = uploadRequest.GetRequestStream()
fileStream = File.Open(fileName, FileMode.Open)

Dim buffer(1024) As Byte
Dim bytesRead As Integer
While True
bytesRead = fileStream.Read(buffer, 0, buffer.Length)
If bytesRead = 0 Then
Exit While
End If
requestStream.Write(buffer, 0, bytesRead)
End While

' The request stream must be closed before getting the response.
requestStream.Close()

uploadResponse = uploadRequest.GetResponse()
Console.WriteLine("Upload complete.")
Catch ex As UriFormatException
Console.WriteLine(ex.Message)
Catch ex As IOException
Console.WriteLine(ex.Message)
Catch ex As WebException
Console.WriteLine(ex.Message)
Finally
If uploadResponse IsNot Nothing Then
uploadResponse.Close()
End If
If fileStream IsNot Nothing Then
fileStream.Close()
End If
If requestStream IsNot Nothing Then
requestStream.Close()
End If
End Try
End Sub

Private Sub List(ByVal listUrl As String)
Dim reader As StreamReader = Nothing
Try
Dim listRequest As FtpWebRequest = WebRequest.Create(listUrl)
listRequest.Method = WebRequestMethods.Ftp.ListDirectoryDetails
Dim listResponse As FtpWebResponse = listRequest.GetResponse()
reader = New StreamReader(listResponse.GetResponseStream())
Console.WriteLine(reader.ReadToEnd())
Console.WriteLine("List complete.")
Catch ex As UriFormatException
Console.WriteLine(ex.Message)
Catch ex As WebException
Console.WriteLine(ex.Message)
Finally
If reader IsNot Nothing Then
reader.Close()
End If
End Try
End Sub

End Mole

可以通過設置 Credentials 屬性來指定用於連接伺服器的憑據,也可以將它們包含在傳遞給 Create 方法的 URI 的 UserInfo 部分中。

從 FTP 伺服器下載文件時,如果命令成功,所請求的文件的內容即在響應對象的流中。通過調用 GetResponseStream 方法,可以訪問此流。

如果使用 FtpWebRequest 對象向伺服器上載文件,則必須將文件內容寫入請求流,請求流是通過調用 GetRequestStream 方法或其非同步對應方法(BeginGetRequestStream 和 EndGetRequestStream 方法)獲取的。必須寫入流並在發送請求之前關閉該流。

請求是通過調用 GetResponse 方法或其非同步對應方法(BeginGetResponse 和 EndGetResponse 方法)發送到伺服器的。請求的操作完成時,會返回一個 FtpWebResponse 對象。FtpWebResponse 對象提供操作的狀態以及從伺服器下載的所有數據。

㈥ 高手求助sun.net.ftp.FtpClient下載中文名文件問題。

如果文件名是中文的話,報200、227、501錯誤,就檢查伺服器設置的OPTS,UTF8,是否為逗禁用命令地。全局屬性第三個是否關閉。

ftp上傳文件時,必須使用英文字元或數據的文件名才能上傳,或者是兩個字的漢字才能上傳到伺服器的話:
1、進入ServerU管理端界面,點擊逗伺服器限制和設置地分類功能按鈕,

2、在ServerU伺服器限制和設置界面,選擇逗FTP設置地頁簽,點擊窗口下面的逗全局設置地按鈕。

3、在打開的逗FTP命令屬性地界面,去掉最後一行的勾選,即不要勾選地對所有已收發的路徑和文件名使用UTF-8編碼逗。

4、選擇逗FTP設置地頁簽,禁用地OPTS UTF8 逗,
完成上面的兩處改變後,無法上傳中文名稱的文件的問題應該已經解決了。

熱點內容
吃雞安卓主播用什麼投屏 發布:2025-04-16 06:29:33 瀏覽:815
python元素是否存在 發布:2025-04-16 06:16:39 瀏覽:327
優酷上傳侵權視頻 發布:2025-04-16 06:15:03 瀏覽:49
現代伊蘭特7代有哪些配置 發布:2025-04-16 06:12:26 瀏覽:649
啪啪訪問視頻 發布:2025-04-16 05:57:35 瀏覽:858
電信烽火盒子設置密碼是多少 發布:2025-04-16 05:56:48 瀏覽:407
sqldatetime 發布:2025-04-16 05:51:08 瀏覽:892
javaweb項目源碼下載 發布:2025-04-16 05:17:31 瀏覽:880
python2713 發布:2025-04-16 05:17:24 瀏覽:68
excel批量清除資料庫數據 發布:2025-04-16 05:16:50 瀏覽:207