Fórum Envio de arquivos via FTP no mobile em C# #21378
29/07/2009
0
Bom Dia Pessoal, so iniciante no C, e estou tendo um problema neste codigo abaixo, estou usando o VS2008, e quando vo compilar a aplicação da o erro abaixo tambem, fico de um aguardo de ajuda dos amigos do forum....
Codigo para envio de arquivo para o FTP
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Net;
namespace SmartDeviceProject5
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
string ftpIP = ´endereço ftp´;
string ftpUsuario = ´usuari´;
string ftpSenha = ´Senha´;
// metod enviar
[/size][size=´2´]private void ftpEnviar(string nomeArq)
{
try
{
FileInfo infoArquivo = new FileInfo(nomeArq);
string uri = ´ftp://´ + ftpIP + ´/´ + infoArquivo.Name;
FtpWebRequest reqFTP;
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(´ftp://´ + ftpIP + ´/´ + infoArquivo.Name));
reqFTP.Credentials = new NetworkCredential(ftpUsuario, ftpSenha);
reqFTP.KeepAlive = false;
reqFTP.Method = WebRequestMethods.Ftp.UploadFile;
reqFTP.UseBinary = true;
reqFTP.ContentLength = infoArquivo.Length;
int buffLength = 2048;
byte[] buff = new byte[buffLength];
int conteudoLen;
FileStream fs = infoArquivo.OpenRead();
try
{
this.Text = ´Aguarde...´;
Stream strm = reqFTP.GetRequestStream();
conteudoLen = fs.Read(buff, 0, buffLength);
while (conteudoLen != 0)
{
strm.Write(buff, 0, conteudoLen);
conteudoLen = fs.Read(buff, 0, buffLength);
}
this.Text = ´Concludo´;
strm.Close();
fs.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
catch (Exception)
{
}
}
}
}
erro na hora da compilação,
Error 1 The type or namespace name ´FtpWebRequest´ could not be found (are you missing a using directive or an assembly reference?)..
Pessoal se alguém tiver uma ideia do que pode estar havendo, agradeço pela atenção pois estou com a corda no pescoço......
Codigo para envio de arquivo para o FTP
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Net;
namespace SmartDeviceProject5
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
string ftpIP = ´endereço ftp´;
string ftpUsuario = ´usuari´;
string ftpSenha = ´Senha´;
// metod enviar
[/size][size=´2´]private void ftpEnviar(string nomeArq)
{
try
{
FileInfo infoArquivo = new FileInfo(nomeArq);
string uri = ´ftp://´ + ftpIP + ´/´ + infoArquivo.Name;
FtpWebRequest reqFTP;
reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(´ftp://´ + ftpIP + ´/´ + infoArquivo.Name));
reqFTP.Credentials = new NetworkCredential(ftpUsuario, ftpSenha);
reqFTP.KeepAlive = false;
reqFTP.Method = WebRequestMethods.Ftp.UploadFile;
reqFTP.UseBinary = true;
reqFTP.ContentLength = infoArquivo.Length;
int buffLength = 2048;
byte[] buff = new byte[buffLength];
int conteudoLen;
FileStream fs = infoArquivo.OpenRead();
try
{
this.Text = ´Aguarde...´;
Stream strm = reqFTP.GetRequestStream();
conteudoLen = fs.Read(buff, 0, buffLength);
while (conteudoLen != 0)
{
strm.Write(buff, 0, conteudoLen);
conteudoLen = fs.Read(buff, 0, buffLength);
}
this.Text = ´Concludo´;
strm.Close();
fs.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
catch (Exception)
{
}
}
}
}
erro na hora da compilação,
Error 1 The type or namespace name ´FtpWebRequest´ could not be found (are you missing a using directive or an assembly reference?)..
Pessoal se alguém tiver uma ideia do que pode estar havendo, agradeço pela atenção pois estou com a corda no pescoço......
Michel Schmidt
Curtir tópico
+ 0
Responder
Clique aqui para fazer login e interagir na Comunidade :)