想上传ascii文件 [英] Would like to upload a file as ascii

查看:66
本文介绍了想上传ascii文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

希望能够将此文件作为ascii上传到iseries而不是以二进制形式上传。有没有办法做到这一点?

public static void SendFile(string sourcePath,string server,string userName,string password,string remoteFolder,string remoteFileName)

{

using(WebClient client = new WebClient())

{

string dest = string.Format(CultureInfo.InvariantCulture,ftp:// { 0} / {1} / {2},server,remoteFolder,remoteFileName);

client.Credentials = new NetworkCredential(userName,password);

client.Proxy = null;

//client.Encoding = Encoding.UTF8;

client.UploadFile(dest,STOR,sourcePath);

}

}



我的尝试:



尝试查看编码但没有太大成功。

Would like to be able to upload this file as ascii on the iseries instead of it coming in as binary. is there a way to do this?
public static void SendFile(string sourcePath, string server, string userName, string password, string remoteFolder, string remoteFileName)
{
using (WebClient client = new WebClient())
{
string dest = string.Format(CultureInfo.InvariantCulture, "ftp://{0}/{1}/{2}", server, remoteFolder, remoteFileName);
client.Credentials = new NetworkCredential(userName, password);
client.Proxy = null;
//client.Encoding = Encoding.UTF8;
client.UploadFile(dest, "STOR", sourcePath);
}
}

What I have tried:

tried looking at Encoding but not much success.

推荐答案

使用 FtpWebRequest类(System.Net) [ ^ ]。



然后你可以设置 FtpWebRequest.UseBinary Property(System.Net) [ ^ ]。


这篇关于想上传ascii文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆