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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

asp to copy image from server to another server!!ASAP!!! 1

Status
Not open for further replies.

pollux0

IS-IT--Management
Mar 20, 2002
262
US
I need to create code that when an image (or file) is uploaded to the server using the admin section of a website, the file is copied automaticaly to a second server.


Thanks in advance
 
Well If your server(s) is/are on a network, then you could most likely use the same upload code, and just use the network path instead of the drive path. www.vzio.com
ASP WEB DEVELOPMENT



 
I tried but I can not get it to work...

thanks
 
Can you give us a little more information?

What is not working? What is the error you are getting? Can you give us a code sample of how you are trying to copy your file?

First off, make sure IIS (or MTS if you are running a COM object in it) has write access to the destination folder.

Thanks,

Gabe
 
I had somewhat of the same problem.. What I did was use the WScript.Network object to dynamically map a network drive.. copy the image and unmap the drive..

<%
set netdrive = server.createobject(&quot;wscript.network&quot;)
set fso = server.createobject(&quot;scripting.filesystemobject&quot;)

netdrive.MapNetworkDrive (&quot;Z:&quot;,&quot;\\network\path&quot;)
fso.CopyFile (&quot;<source of first saved file>&quot;,&quot;z:\<path>\<filename>&quot;, true)
set fso = nothing
netdrive.RemoveNetworkDrive (&quot;Z:&quot;)

set netdrive = nothing
%>
 
Thanks Gorkem thats what i am looking for. I am getting an access denied error..I think it has something to do with the IUSER_ account not having privleges?????
 
The MapNetworkDrive method allows you to also add a username and password for mapping the drive as another user which would have priveleges.

netdrive.MapNetworkDrive (&quot;Z:&quot;,&quot;\\network\path&quot;, &quot;<username>&quot;,&quot;<password>&quot;)


Cheers,

Gorkem.


 
Thanks!

I am aslo getting an error message
&quot;Cannot use parentheses when calling a Sub &quot;



 
I tried that but i get an error &quot;type mismatch line 6&quot; (netdrive.MapNetworkDrive &quot;p:&quot;,.....)
**************************************************
<%
set netdrive = server.createobject(&quot;wscript.network&quot;)
set fso = server.createobject(&quot;scripting.filesystemobject&quot;)

netdrive.MapNetworkDrive &quot;p:&quot;,&quot;\\computer\web&quot;,&quot;jon&quot;,&quot;****&quot;
fso.CopyFile Up.Files.Item(&quot;file1&quot;),&quot;p:\*******&quot;, true
set fso = nothing
netdrive.RemoveNetworkDrive (&quot;p:&quot;)

set netdrive = nothing
%>
 
ok.. I see the problem..

try this:

netdrive.MapNetworkDrive &quot;p:&quot;,&quot;\\computer\web&quot;,TRUE,&quot;jon&quot;,&quot;****&quot;


 
man..its error after error!!! :)

Error:
A specified logon session does not exist. It may already have been terminated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top