How to attach a file from oyur local PC onto the Web server that does host hte asp file?

S

srini

Hi experts,

I have the below scenario:

1. I have a html form that has a field for attachment. Once the user
clicks on the Browse button, the file is attached from his local PC.

2.Then, I have an asp script that triggers on Submit action in the
html form. Both html and ASP pages are hosted on a web server, which
is in the same domain as the user's PC.

3. I have the below lines of code in the ASP file.

' code start---------------------
dim attachedFile
attachedFile = Request.Form("attachedfile")

Dim fso, finalAttachment

Set fso = CreateObject("Scripting.FileSystemObject")
Set finalAttachment = fso.GetFile(attachedFile)
' code over----------------------

4. Now I get the below error:
-------------
Error Type:
Microsoft VBScript runtime (0x800A0035)
File not found
/ptg/submitForm.asp, line 50
--------------------

Here I understand that when I attach a file from a user machine, the
web server expects it to be on its local file system.

How can I make sure that the ASP script takes a file from the local PC
and makes the script think that it is on its (web server) local file
system?
Can any one help me out here?

Thanks,
Srini
 
T

Toby A Inkster

How can I make sure that the ASP script takes a file from the local PC
and makes the script think that it is on its (web server) local file
system?

ASP is crap for file uploads. You will need to download a third-party file
upload component to make it work, or better yet: use PHP instead.
 
S

SpaceGirl

Toby A Inkster said:
ASP is crap for file uploads. You will need to download a third-party file
upload component to make it work, or better yet: use PHP instead.

ASP.NET, however, is superb - ASP is terribly out-dated now, and .NET does a
vast amount more far more efficiently. Try that instead with one of it's
hosted languages (C#.NET, VB.NET). This of course assumes your host supports
..NET. Many do now.
 
H

Hywel

schimata2 said:
Hi experts,

I have the below scenario:

1. I have a html form that has a field for attachment. Once the user
clicks on the Browse button, the file is attached from his local PC.

2.Then, I have an asp script that triggers on Submit action in the
html form. Both html and ASP pages are hosted on a web server, which
is in the same domain as the user's PC.

3. I have the below lines of code in the ASP file.

' code start---------------------
dim attachedFile
attachedFile = Request.Form("attachedfile")

That won't work. At best all it will give you is the name of the file.
Have you got the correct entype in your form? Have you read this:
http://www.asp101.com/articles/jacob/scriptupload.asp
 
H

Hywel

There are two ASP upload solutions on that page. Both require you to
download a library or somesuch.

Yes, but they're not components - it's plain ASP and so can be used
without the need for interference form the server admin. to install.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top