ftp a file from a form

Posted on 2004-11-23
Medium Priority
Last Modified: 2010-04-09
I am building a sample application that would normally run over an intranet in an internet environment, so the normal file system commands I would use are not available.

I need to be able to ftp a file to a server which is an sql server rather than the web server that is hosting the page.

I want the user to be able to use a form to browse to a file (that bit I can do!) and then on submit the file should be FTP'd to the server.  I have: the server IP, the directory structure I want to FTP to, the user name and the password.

Is there a simple script (I'm not a techie) that I can use to do the FTP?

The application is SQL/ASP based.

Question by:bigoldbird
  • 3
  • 2
  • 2
  • +2
LVL 14

Expert Comment

ID: 12653052
I don't know what do you mean by ftp to file server.

Basically SQL server is not a FTP server.

To upload a file to database

You need to have multipart html form, asp page and database table with blob column to hlod your file in database

LVL 54

Expert Comment

by:Ryan Chong
ID: 12653119
what browser is you refer to?

Actually you can do it in IE, without any programming needed, just try typing the FTP address on a IE browser address bar, and it will prompt you for the username and password.

After logged in, you can just do a "Copy and Paste" just the same you did on your Windows folder.

If you want an Interface, i suggest you download a FTP client from some popular softwares download sites instead. No worth to research and develop a FTP component here.


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.


Author Comment

ID: 12653214

Thank you for your comments.  I know that an SQL server is not an FTP server but in this instance I need to get a file from a client computer onto the SQL server so that I can run an BULK INSERT procedure.

I can't use ASPupload (well I don't think so) because the SQL server is not the IIS server where the loading page will be hosted.


Expert Comment

ID: 12655984
Well, you're going to need to create //& install an application on the SQL server.. that allows you to transmit files to it.. Such as an FTP server.

Just basically an application that creates a Server Socket, and allows transmission of a file.

Note, I can't see how you can transfer a file using just HTML -- I'm pretty sure it can't be done.. you'll need to use a CGI language most likely for the transmission. (e.g. PHP, JSP, ASP, ..).


Author Comment

ID: 12656187
I did ask this question on the ASP pages but didn't get an answer at all.

I have FTP working to the server but I wanted a solution that would only involve the usering in putting the file without being able to browse or download files from the server.  Not for particularly security reasons, just to limit the risk of error and to make it as simple as possible for the user.


Assisted Solution

DrWarezz earned 750 total points
ID: 12656355
Okay, well, I personally don't do ASP (I avoid all Microsoft languages (bar C#/VC++) ;-)).

However, I can give you the code to upload a file in PHP or JSP ... if either, choose one, and I'll direct you on how to use it, and post the necessary code.


Accepted Solution

ERNesbitt earned 750 total points
ID: 12666283
You could upload the file to the IIS server and then move it via a batch file over the network to the SQL server.  Refer to http://www.experts-exchange.com/Programming/Q_20975928.html#10983398 for the command line in your batch file using xcopy.

Your ASP will look like this:

strFilePath = "<Drive>:\<Directory>\<file>.bat"
Set objWshShell = server.CreateObject("WScript.Shell")
rtn = objWshShell.Run(strFilePath, 1, True)
Set objWshShell = Nothing

This is untested, so it may require some tweaks.

Author Comment

ID: 12676042
Thank you both :-)  I actually did it with a simple ftp script in the end which is fairly similar to ERNesbitts solution.  I split the points because you have both been great.

Again, thanks

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question