Uploading a file thru FTP

A

Abhishek

Hi! Everyone

I have a small issue, if anyone could help me out
I need to upload user files to my website thru my web application. something
similar to attaching a file to the mail.
I know one way of doing it is thru HTTP but that gives a limitation of 4mb
I was doing it thru FTP and it worked fine during preliminary testing on the
localhost.

but when i tried it doing thru intranet it gave me a problem,
It took file to be uploaded path from the server instead of the local system
where the webpage was open
e.g. if the upload file path was given as "e:\abc.doc" it will try and
upload the file from the server at this path and not from the system where
the web page is running from.
Any workarounds will be greatly appreciated

If this can help in any way I am using .Net

Regards,
Abhishek
 
G

Guest

It seems like you have used localhost for identifying you ftp server and then
call get on that server server. I guess that what you need is to:

1. connect from your client machine to the ftp server: open servername
2. run put command with the filename you want to transfer to the server.

Be aware that ftp client should be running on the client machine and ftp
server on the server machine. Accessing file system on the client from a
webpage might need some additionary security adjustments.
 
A

Abhishek

I have uploaded the webapp on my server
Now i am running the application from my server (normal web hosting server)
I am uploading it to another FTP server . Now I am receiving this error


System.IO.FileNotFoundException: Could not find file "C:\Documents and
Settings\Administrator\Desktop\12.txt". File name: "C:\Documents and
Settings\Administrator\Desktop\12.txt" at System.IO.__Error.WinIOError(Int32
errorCode, String str) at System.IO.FileStream..ctor(String path, FileMode
mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean
useAsync, String msgPath, Boolean bFromProxy) at
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access,
FileShare share) at HB.Web.Ftp.FileTransfer.OpenFile(Boolean upload) at
HB.Web.Ftp.FileTransfer.Transfer(Boolean upload, Socket dataConnection,
TextWriter serverOutput) at HB.Web.Ftp.FileUpload.Upload(TextWriter
clientOutput, TextWriter serverOutput) at
HB.Web.Ftp.PassiveFileUpload.Upload(TextWriter clientOutput, TextWriter
serverOutput) at WebApplication1.creatNew.UploadFile(String szRemotePath)

Now here the " C:\Documents and Settings\Administrator\Desktop\12.txt " is
of my local file that i want to upload

any suggestions or ideas?

Regards
Abhishek
 
N

Nick Malik [Microsoft]

Hello again Abhishek,

For FTP to work, there has to be a program running on the client computer
and another program running on the Server.

I don't know what HB.Web is, but from the fact that this is a web
application, you have your FTP "client" running on the web server. That
will give you the right to send FROM the web server to somewhere else, but
not the ability to send from the client to the server.

Of course it would work on your workstation. You are both the client and
the server. You are sending to yourself.

A rich client MUST run on a client machine (one that is using FTP to
transmit files). You can use the built-in Windows FTP client (command line)
or you can write your own or you can purchase one. CuteFTP is nice, as you
know. Although I haven't done a lot of checking, I imagine that there are
ActiveX controls out there that will act like a rich FTP client (but they
would probably need to be installed on the client machine using an MSI in
order to overcome the security limitations placed by Windows XP SP2).

I hate to say this, but... redesign your app.

I hope this helps,

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

FTP server 1
ftp uploads 1
Upload a text file thru webclient 12
FTP Uploading 4
"Simple" FTP transfer 6
Uploading file to UNIX host 5
getting problem when uploading a file to other server 1
Upload and server FTP 2

Top