473,385 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Uploading a file thru FTP

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
Nov 16 '05 #1
3 6323
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.

"Abhishek" wrote:
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

Nov 16 '05 #2
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

Nov 16 '05 #3
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.
--
"Abhishek" <ab******@alwayshelpful.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
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

Nov 16 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Kevin Ollivier | last post by:
Hi all, I've come across a problem that has me stumped, and I thought I'd send a message to the gurus to see if this makes sense to anyone else. =) Basically, I'm trying to upload a series of...
7
by: Roger Withnell | last post by:
I would like to check that an image file, selected by a user using fileUpload, is within certain parameters (width, height, filesize) and to display the image file so that the user can see the...
10
by: John Smith | last post by:
I know that uploading an image to a database has been covered, oh, about 3 trillion times. However, I haven't found anything covering uploading to a MySQL database with .net. Please don't...
13
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming...
4
by: VB Programmer | last post by:
I know how to upload an individual file to a server (See below code snippet). QUESTION: Is there an easy way to upload an entire subdirectory and all it's files? Or, do I have to loop thru the...
4
by: Himanshu | last post by:
hi, Can anybody tell me that thru asp.net using c#, how can we upload and download physical files in any table of SQL Server Database. the uploading part is running successfully but the...
3
by: Jason Chu | last post by:
I've written a file uploading part of my application using the IHttpModule. So now, I don't have the memory problem of uploading something big. Problem: I can't find which function I have to...
3
ganesanji
by: ganesanji | last post by:
hi all, I have written a php coding for uploading a file to a specific folder or location in server which is a Linux server. I think the coding for file uploaing is correct. But it does not...
3
by: zo62 | last post by:
I am building an XML document thru code then saving it on my local machine as well as posting it the an FTP site. When opening the XML document in my local machine. the Document is well indented and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.