I get the following support problem about once per week from ASP developers:
The ASP developer wants to upload a file from the client computer where the browser is running, to an FTP server. He writes ASP code to do the FTP upload, but cannot understand why the file is not found. The thing the ASP developer doesn’t realize is that his ASP code runs on the web server, not on the client computer where the browser is running.
When I detect this misunderstanding, I’ll be pointing you to this blog post. Here’s a summary of what you should know:
- Your browser, such as Internet Explorer, is running on computer “A”.
- The browser communicates with a web server running on computer “B”.
- Your ASP code runs within the web server’s worker process on computer “B”.
- Your FTP server runs on computer “C”.
- Your ASP code (running on computer “B”) is trying to upload a file to the FTP server on computer “C”. Therefore, it is trying to transfer a file from “B” to “C”.
- If you want to upload a file from computer “A” to the FTP server (computer “C”), you need to first do an HTTP upload via HTML using a Form with “<input type=”file” …”. This uploads from the computer where the browser runs to the web server. Your ASP code then uploads the code from the web server to the FTP server.