473,508 Members | 2,079 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

upload and how to refer files

8 New Member
hi guys~~

i have this problem..i hv download the free asp upload..and it works great..

so i want to implement it in my addCan.asp page..

there's a button in addCan.asp that'll link to the upload forms.
i add button OK in the upload forms to link user back to the addCan.asp page after the uploading being done.

the problems is i can't get the file name from the upload form to the addCan.asp form. i need to do this bcoz i want to save the file name according to the id in the addCan.asp

fyi, i hv a textbox in addCan.asp that'll capture the file name from the upload form.


thanks
*__* ------>totally lost
Apr 7 '08 #1
3 1890
jhardman
3,406 Recognized Expert Specialist
show the form code.

Jared
Apr 7 '08 #2
colesslow
8 New Member
this is the upload form-----------


<%@ Language=VBScript %>
<%
option explicit
Response.Expires = -1
Server.ScriptTimeout = 600
%>
<!-- #include file="freeaspupload.asp" -->
<%

Dim uploadsDirVar
uploadsDirVar = "C:\Inetpub\wwwroot\candidate\up"

function OutputForm()
%>
<form name="frmSend" method="POST" enctype="multipart/form-data" action="uploadTester.asp" >
<B>File names:</B><br>

File: <input name="attach1" type="file" size=35 id="att1"><br>

<br>
<input style="margin-top:4" type=submit value="Upload">

<br><br>

</form>
<%
end function

function SaveFiles
Dim Upload, fileName, fileSize, ks, i, fileKey,item

Set Upload = New FreeASPUpload
Upload.Save(uploadsDirVar)

' If something fails inside the script, but the exception is handled
If Err.Number<>0 then Exit function

SaveFiles = ""
ks = Upload.UploadedFiles.keys
if (UBound(ks) <> -1) then
SaveFiles = "<B>Files uploaded:</B> "


for each fileKey in Upload.UploadedFiles.keys
SaveFiles = SaveFiles & Upload.UploadedFiles(fileKey).FileName & " (" & Upload.UploadedFiles(fileKey).Length & "B) "
item= Upload.UploadedFiles(fileKey).FileName
%><INPUT type="hidden" value="<%=item%>" name="attach"><%
next

end if

end function
%>

<HTML>
<HEAD>

</HEAD>

<BODY>
<br><br>

<%
outputform()
Response.Write savefiles()
%>
<script language=javascript>
function ToUpload(item){
var frm ;
frm = document.frmSend ;
frm.action="addCandidate.asp";
frm.submit();
}
</script>
<input type=submit value="OK" onclick="ToUpload();">
<br><br>
</BODY>
</HTML>

so when the user click button ok, he'll be direct to the addCandidate.asp page

<HTML>
<HEAD>

</head>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">

<BODY>
<form name="addCandidate" method="post" action="AddRecord.asp">

<tr>
<td><input class="text field" name="fullName"></td>
</tr>

<tr>
<td><input class="textField" name="Address"></td>
</tr>

<tr>
<td><input class="textField" name="attachment" ></td>

</tr>

<tr>
<td align="middle">
<input type="submit" value="Add" id=submit1 name=submit1>
</td>
</tr>
</form>
</BODY>
</HTML>

the attachment field is where i want to request the file name from the uploadpage.
I've use <input class="textField" name="attachment" value="<%=request.form("attach")%>"> in the attachment field and error message Cannot use Request.Form collection after calling BinaryRead. shown..

i also use

value="<%=UploadFormRequest("attach")%>" but type mismatch


actually im not good in asp..
still crawling~~really hope u can help me..
Apr 8 '08 #3
garethharvey
15 New Member
You can get the file name from:

<%
outputform()
Response.Write savefiles()
file_name=savefiles()
%>

file_name being the name of the file you have uploaded.
Apr 9 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
11737
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a...
1
1587
by: Ron Vecchi | last post by:
When posting a file upload I have taken in consideration the maxRequestLength and set it accordingly. In my case where a posibility of a 30 meg file can be uploaded I set it to 30720. Although...
0
4737
by: SEMIH DEMIR | last post by:
Sitelerden birinde verilen yabancı kaynakli bir scriptti duzenledim yanlız birseyin içinden bir turlu cıkamadım işin aslı ilk defa persistin upload componentini kullanacam yanlız suanki haliyle...
9
3815
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web...
3
7987
by: c676228 | last post by:
Hi everyone, I will develop a program to enroll a group of people on-line. Since we don't have number limitation for the people in the group. I am wondering if there is any company allow people...
7
3168
by: pbd22 | last post by:
hi. i am having probs understanding how to grab a file being uploaded from a remote client. i am using hidden input fields for upload such as: <input id="my_file_element" type="file"...
17
1672
by: Paul | last post by:
On my development computer, I have virtual named host set up, like www.site1.lab. When I upload those to my web site for customer review under mywebsite.com/clients/site1/ it throws some of the...
21
34327
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Uploading files from a local computer to a remote web server has many useful purposes, the most...
2
2459
by: =?Utf-8?B?TWlrZSBLcmFsZXk=?= | last post by:
In my ASP.NET application, I'd like to set limits on the maximum size of an uploaded file. Normally I'd just set the maxRequestLength of the httpRuntime element in web.config. But in this case,...
0
7226
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7125
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7388
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7049
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7499
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5631
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5055
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4709
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3199
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.