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

File upload over an Intranet

Status
Not open for further replies.

walderr

Programmer
Jul 18, 2003
32
GB
Is there a fairly simple way for a user to upload files over an intranet to a standard location? I've just designed a website which allows the user to add the location of a document to a database, but that's not much use if the file is on their harddrive etc so I want to take it a step further.

I'm not familiar with ftp servers and how they work, so I was wondering if there's a way to copy the documents to the specified location using .asp code or similar. Anyone have any comments?
 
Thanks, I'll give that a shot... but tomorrow I think, cos the office bar is calling me now!

Cheers.
 
I've settled on using ASP Simple Upload, as it seems the simplest. However, being new to all this sort of thing, I've come across an error which is confusing me a bit. On one line, I've got:

Set upl = Server.CreateObject("ASPSimpleUpload.Upload")

but it gives an error at this line saying 'Invalid Prog ID'. It's definitely not the script that's wrong, as I've copied and pasted it from numerous sources. Does something need installing, or am I just getting very confused?! I don't quite understand what the line even does really!!
 
references


not sure if that component ASPUpload is the one you need. I haven't used this objedct in the past.

1H 1K 10 3D 3F 3E 3K 38 3J 10 1T 10 3G 3L 3I 35 10 35 3O 33 35 3C 3C 35 3E 33 35

brickyard.jpeg
2 more days
 
wow, you picked a bunch of a object to use. [lol]

I could not found one place that I was able to download the AspSimpleUpload.exe
which if you do not have will not work. Now that I taought myself a bit on the object.


1H 1K 10 3D 3F 3E 3K 38 3J 10 1T 10 3G 3L 3I 35 10 35 3O 33 35 3C 3C 35 3E 33 35

brickyard.jpeg
2 more days
 
In case you decide to try a non-component solution, first let's deal with the timeout issue which can be a problem if a user is uploading a fairly large file (although perhaps you don't want the timeout increased too much because you DON'T want a user uploading a large file).

For pure ASP (i.e. non component) solutions (and I believe this would be true for component solutions too) can increase the timeout for the page:
' Script timeout in seconds for this page.
' (60 x 60 = 1 hour.)
Server.ScriptTimeout = 60 * 60

Also the Anonymous Internet user needs Change permission on the folder that a file is going to be uploaded to and actually Full Access might be better if you are later going to use the FileSystemObject to delete a file.

Here is a resource for letting the user upload a file which is something that was unfortunately not built into ASP:

ASP File Upload Using VBScript by John R. Lewis - 7/10/2000

Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
 
Thanks for the pointers. Having decided on using Simple Upload, my IT department claimed never to have heard of ASP, and didn't seem keen on putting the .exe file on the servers, so it looks like I'll be using a pure asp method then...!

I've started looking at the one in the first link given by onpnt, but I'm getting a "Cannot call BinaryRead after using Request.Form collection" error. I'm guessing this comes about because I'm trying to do two things on the same page:

a)Upload the file to a set location
b)Send other information submitted in the same form to a database.

If this is right, do you know of any way I can avoid this, whilst still using the same form? Thanks if you do!
 
Whatever file uploading solution you use, on the page in question you will no longer be able to refer to regular form fields with Request.Form("MyField"). Instead there will be some kind of proprietary way to refer to the fields.

Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
 
Right, I've read up on it a bit now so I actually understand what is going on! I can see what you're saying - in this case the way to replace "Upload.Form" is with "Uploader.Form".

I've changed all the relevant code to this, but I've now run into another problem. Depending on where I insert the asp into the target page, I either get an error message, or it ignores the variable in the file field.

If I put the code at the top, it says it expects an identifier after Uploader.Form, which I've actually got - I have Uploader.Form("AddIDNumber") in one field for example, which works fine in the example. If I put the code at the bottom, it reads all the variables except the file path field (which it thinks is blank, as it returns to the form with an error message I've included to instruct the user to fill all fields).

Therefore, I'm wondering where to put the code in the first place and then what to change to make it work! Hope that's enough info!
 
Sorry that should have been the other way around - code at the top reads all the variables except the file field, code at the bottom gives "Object Expected: ""
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top