Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

uploading files from one server onto another? 1

Status
Not open for further replies.

albie101

Programmer
Oct 8, 2001
50
NZ
Hi all,

I am able to upload files from users onto the webserver, but is it possible to upload them from the users onto another server with the asp pages being on the webserver? (Is anyone confused by this? - I am!)

If not, can I copy them from the webserver to the other server using that file system object?

Thanks,
Em
 
I'm not confused. You want a visitor working on your web server (ASP pages) to be able to upload a file on another server or both. Well, I'm assuming that you're speaking of another public server outside of your internal network. Otherwise I would just tell you to map a drive to the other server on your internal network.

I have played with this, with no success, with the basic tools that I have. I have discussed with colleagues about setting up a VPN connection to an outside public server, mapping that connection to a network drive on the home server, then using the file system object on that mapped drive.

There is one other option for your solution. Could have your upload form post to an ASP page on the other server ?? Of course, you would have to place an ASP script on that server, but with some creative redirects, JavaScript and hidden fields, it could be accomplished.

TW
 
Hi,

Actually the server is an internal one on the network. By mapping a drive, are you suggesting I should map the drive on the server and then point to it? I didn't think of trying that. Thanks! I will give it a go...

Em
 
Help!

I tried mapping the network drive (mapped to f:) on the server and then using:

folderspec = "f:\"

Set f = fso.GetFolder(folderspec)
Set sf = f.SubFolders
For Each f1 In sf
s = s & f1.name
s = s & " | "
Next
Response.Write s

to get a list of all the folders. Unfortunately this doesn't work. It dies on:

Set f = fso.GetFolder(folderspec)

with the error:

Error Type:
Microsoft VBScript runtime (0x800A004C)
Path not found
/structure/Subscriptions/UploadSubscriptions.asp, line 125

Any ideas?? The same code works fine if I substitute "f:" for "c:" I get that it can't find the f: (which is my mapped drive). Is there another way to do this?

Em
 
I'm stumped.. We use FSO on mapped drives, no problem. I don't know any other way to access a network drive with FSO.

Sorry.

TW
 
Thanks for the help anyway. Anyone else have any ideas (on either why the FSO isn't working or any other ways to do this)?

Thanks
Em
 
Hi,

Tood in an earlier post said something about creating an asp page on the other server. I have done that, but am still unable to access the drive. I am getting to the asp page on the other server through a virtual directory on my web server, but even from that page I still get the path not found error. Is this because I am still within the virtual directory and can't see out of it? If so, is there another way for me to access the asp page on the other server?

Any suggestions?

Thanks
Em
 
If that "other server" has IIS, you could setup a website there with one ASP page that uploads a file to that server. Have your current site post the upload form to the other site / server. Of course in that case, the FSO would be accessing a local drive (C:) because the ASP is running on the other server. My initial post was more related to posting a file to another public server outside of your domain. I still think the network map should work, I just wish I had the experience to help you troubleshoot that.

TW
 
Just for kicks, make sure the networked drive is mapped to F: and that you can access the drive. I mean can you see the contents of the drive when you click on it in File Explorer. Then, run this exact code on a test asp page and tell me what happens.

<%@ Language=VBScript%>
<%Option Explicit%>
<%
dim objFile

Set objFile = Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)

IF objFile.FileExists(&quot;f:\testfile.txt&quot;) THEN
Response.Write &quot;Yes, I do see the mapped drive.&quot;
END IF

set objFile = Nothing
%>

If you get an error, copy it and post it back here. I'm going to look back at our drive maps and see if I see something that I think you might have missed during the map setup. What operating system are you using on the server ?

TW
 
Hi Todd,

Thanks for the help. Unfortunately I can't do anything more on it right now as I will be away a few days. I will give it a go when I get back though and will let you know how I get on.

Em
 
Hi Todd and everyone else, I'm back, and still need help!

Ok, have managed to try a few things. Firstly, I did what Todd suggested above and although I didn't get an error, I didn't get the &quot;Yes, I do see a mapped drive&quot; text either.

I also tried doing the exact same thing from a VB exe and it worked fine. Could this be a shortcoming of the fileSystemObject in VBScript?

The other thing is, I've tried it on a few different computers, and it actually worked on one of them (using VBScript), but not on any others. Any suggestions on what I should check?

If we can't work it out I'm just going to have to create a VB service to run I guess, although I don't really want to have to do this...

Thanks for you help,
Emma
 
Sorry, my goof..

I forgot to tell you to create a file in notepad and name it testfile.txt and place it in that mapped directory. Otherwise, that conditional statement won't evaluate to True and you won't see that response. Do that, if you haven't already, and let me know.

TW
 
Yeah - I figured that and tried with the file there, but still no luck.

The server is Win 2000.
 
OK, in my error I think I could have advised a little better on how to test. Here's a much better test.

Place this script, by itself, into an ASP page. Place that page on your web server then run it from the browser.

It will list all of the active drives, including network drives. Tell me what you get.


<%@ Language=VBScript%>
<%Option Explicit%>
<%
dim objFile
dim objDrives
dim i

Set objFile = Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set objDrives = objFile.Drives
FOR EACH i IN objDrives
Response.Write i & &quot;<br>&quot;
NEXT
%>
 
I get the following:
A:
C:
D:
E:

All of which are local drives. My mapped drive (F:) doesn't show.

Em
 
Well, I just mapped drive F: to a network location and it worked fine for me.

I really don't want to give up now after all we've been through. So I'm going to start asking really stupid questions.

Are you sure you created the network map on the web server ?? I mean, when you go to the actual web server, (not a client computer), and double click on My Computer can you see drive F:.

TW
 
yep - just checked and can definitely see it and have access to it.

Could it be something to do with the log ons for the web server, the mapped directory and the user not giving the correct access or something? Just an idea that I don't really know how to go about checking...

Keep asking the stupid questions - surely it's just got to be something pathetic that I missed and we can have a laugh about later when we finally work it out!

Em
 
Not giving up yet !!

I want you to do this for me. You stated that the second test page I sent you returned the following.

A:
C:
D:
E:

Now I want you to go to the web server and place that testfile.txt in the root of drive C:

Then run this and tell me what happens.

<%@ Language=VBScript%>
<%Option Explicit%>
<%
dim objFile

Set objFile = Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)

IF objFile.FileExists(&quot;c:\testfile.txt&quot;) THEN
Response.Write &quot;OK, now we're getting somewhere !&quot;
ELSE
Response.Write &quot;We're having a communication problem here !&quot;
END IF

set objFile = Nothing
%>

 
I did that and got:

OK, now we're getting somewhere!

Does that mean we're getting somewhere?
 
Actually, not really. It does mean that we're not headed in the wrong direction, so that makes me feel a little better. I think this post is getting too long and viewers are probably getting sick of seeing it constantly jumping to the top.

Since we know that the FileSystemObject does work, and that really is the proper way to do file management with ASP, why don't you repost a new question as follows:

=================================================
=================================================
Subject: FSO won't access mapped network drive.
Body: I created a network map on my IIS server to a network share in my network. I gave the map the drive letter F:. I can view and access the share from the web server desktop, but when I run the following code, F: is nowhere to be found. I have also tested FileExists on a file in that share, and still no luck.


<%@ Language=VBScript%>
<%Option Explicit%>
<%
dim objFile
dim objDrives
dim i

Set objFile = Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set objDrives = objFile.Drives
FOR EACH i IN objDrives
Response.Write i & &quot;<br>&quot;
NEXT
%>


That code returns A: C: D: E: to my browser window. Where's F: ??

Stumped.

=================================================
=================================================

Post that to this forum and let's see if we can get a response. In the meantime, I am going to try to duplicate your problem here by testing different share types, etc..

TW
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top