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

ASP Copy file to folder

Status
Not open for further replies.

AGNEW2PRG

Technical User
Aug 5, 2003
98
AE
Hi All,

I am working on a asp page that lets a user select a file and on submit copies to a folder on the server. The below doesnot seem to work, any suggestions / help / comments?

The asp pages are to work on a win xp machine running IIS and will operate on the LAN only. Is this possible ? am on the right track?


<---------- Asp Page ------->

<form name="form1" method="POST" action="filecopy.asp">
<input name="file1" type="file" class="fieldfmt" size="40">
<input name="Submit" type="submit" class="fieldfmt" value="Submit">
</form>


<------------ filecopy.asp------------>
<%
Dim fso, demofile, file_1
file_1 = Request.Form1("file1")

Set fso= CreateObject ("Scripting.FileSystemObject")
Set cmdCopyFile = fso.GetFile(file_1)
cmdCopyFile.Copy("c:\userfiles\")
%>
 
Sorry, I forgot to mention that the folder the files are being copied to is a network shared folder.

Regards

" New To Programming - Learning Fast :)
 
Sorry, I forgot to mention that the folder the files are being copied to is a network shared folder.

Regards
 
By default all of your ASP will run in the security context of an account that is local to the webserver... this account will not be a domain account and will not exist on other computers on your network... so if you want to use ASP to copy something to another computer you need to change the account used by ASP... you can do this on the File Security tab of the ASP page's property sheet in the IIS Administration tool.
 
You MIGHT run into problems with the XP device using the FileSystemObject. Seems I remember something about extra security measures in XP locking this down. As far as I know it only affects FSO access on the server-side and it may only true under special circumstances, I do not remember the details. If you run into trouble at least you have another idea where it might be.

You might have a hard time getting the security working correctly to copy to a remote file server. I strongly suggest that you first work on getting the file to upload to the web server so you know that code is working and THEN work on getting it to write to the file server just so that if you run into problems you have a much better idea where the cause is.


It's hard to think outside the box when I'm trapped in a cubicle.
 

Guys,

I agree with you. I had originally tried this and ran into security issues. I ended up using a ASP upload freeware script I found on the web. This currently works however I have speed issues with the uploads. I was looking to see if I could use an alternative method.

I was also thinking of asp calling an external vbs file. what do you think? how would it access the vbs file with two concurrent users ?

BTW the web server is the machine that I will be uploading the files to.. hopefully this will minimise security issues.

Regards
 
I think most any ASP method you use to upload is going to have speed issues on large files.

I think a vbs file would just cause you further problems. It is just VBScript code but it would most likely cause you even more security problems and I suspect would be interpreted by the servers OS rather than the IIS application which is optimized for interpreting VBScript code in ASP pages so you would probably see an even greater performance hit.

There are com objects for doing file uploads but you will probably have to purchase them.
I have used the script from this site for doing uploads and it works well enough.


It's hard to think outside the box when I'm trapped in a cubicle.
 
In some respects yes, on your end but the end user would have to know how to perform an FTP and have the software to do so though so a lot more is required on their end than the web based approach.



It's hard to think outside the box when I'm trapped in a cubicle.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top