Current location: Hot Scripts Forums » Programming Languages » ASP » Help with radio buttons and uploading


Help with radio buttons and uploading

Reply
  #1 (permalink)  
Old 08-15-03, 02:42 AM
Arctic Arctic is offline
Wannabe Coder
 
Join Date: Jul 2003
Location: BC, Canada
Posts: 120
Thanks: 0
Thanked 1 Time in 1 Post
Help with radio buttons and uploading

Hi, im trying to make my upload page do this. I have 2 sections for files on my server. I want 2 radio buttons, when radio button 1 is clicked is will show the form for uploading files to the downloads section below it. When radio button 2 is clicked it will show the form for uploading (.zip) scripts to the scripts section below it. Any help on this would be great.

<%@ Language=VBScript %>
<%
option explicit
Response.Expires = -1
Server.ScriptTimeout = 600
%>
<HTML>
<HEAD><TITLE>FilesDomain.net - Upload</TITLE>
<link rel=stylesheet type="text/css" href="../style.css">
<script src="../noclick.js" type="text/javascript"></script>
</HEAD>
<BODY background="main_bg.jpg">
<%
Dim filesChecked, scriptsChecked, files, scripts
files="<!--#include file="files_upload.asp"-->"
scripts="<!--#include file="script_upload.asp"-->"

filesChecked = ""
scriptsChecked = ""

SELECT CASE Request.Form("type")
CASE "files"
filesChecked = "CHECKED"
CASE "scripts"
scriptsChecked = "CHECKED"
END SELECT
%>
<font size="2pt">
Pick what type of file you would like to upload:<BR>
<FORM Method=Post>
Files: <INPUT Type=Radio Name=type Value=files <%= filesChecked%>>
Scripts: <INPUT Type=Radio Name=type Value=scripts <%= scriptsChecked%>>
</font>
<INPUT Type=Submit class="button" value="Change">
</FORM>
<%= Request.Form("type")%>
</BODY>
</HTML>
__________________
http://www.streamsearch.ca - Live stream search engine. Find radio stations to listen to and TV channels to watch!

http://www.machonemedia.ca - Mach One Media web development and media services.

Last edited by Arctic; 08-15-03 at 03:47 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 08-16-03, 05:43 PM
Shane Shane is offline
Coding Addict
 
Join Date: Jun 2003
Location: Maryland, US
Posts: 268
Thanks: 0
Thanked 0 Times in 0 Posts
You can't dynamically load the #include tag.


You can, though, do something like this.

Code:
<html>
<head><title>Page Title</title>
</head>
<body>
Header stuff up here...

<%

If Request.Form("type") = "scripts" Then
' Put script form here. 
ElseIf Request.Form("type") = "files" Then
' Put files form here
Else
' Put selection buttons here

End If
%>

</body>
</html>
__________________
Shane Bauer
Microsoft Certified Professional (MCP) - ASP.NET
ASP/ASP.net, C#, VB/VB.NET, PHP, Perl, SQL
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 08-17-03, 02:54 AM
Arctic Arctic is offline
Wannabe Coder
 
Join Date: Jul 2003
Location: BC, Canada
Posts: 120
Thanks: 0
Thanked 1 Time in 1 Post
I set up with the code you gave me, this is what it looks like:

======================
<%@ Language=VBScript %>
<%
option explicit
Response.Expires = -1
Server.ScriptTimeout = 600
%>
<html>
<head><title>FilesDomain.net - Upload</title>
<link rel=stylesheet type="text/css" href="../style.css">
<script src="../noclick.js" type="text/javascript"></script>
</head>
<body background="main_bg.jpg" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table border="0" width="100%">
<tr><td align="center" valign="top">
<table border="0">
<tr><td align="center"><!--#include virtual="adrotator/adrotator_468x60.asp" --></td></tr>
<tr><th><font size="6pt">UPLOAD</font></th></tr>
<tr><td align="center"><font size="2pt">Pick a file from your computer to upload to our server:</font></td></tr>
<tr><td><img src="spacer.gif" width="1px" height="1px"></td></tr>
<tr><td>
<%
If Request.Form("type") = "files" Then

<FORM METHOD="POST" ACTION="upload/files_upload.asp" ENCTYPE="multipart/form-data">
<INPUT TYPE="FILE" NAME="FILE1" SIZE="50" class="textfields">
<INPUT TYPE="FILE" NAME="FILE2" SIZE="50" class="textfields">
<INPUT TYPE="FILE" NAME="FILE3" SIZE="50" class="textfields">
<INPUT TYPE="FILE" NAME="FILE4" SIZE="50" class="textfields">

<INPUT TYPE="SUBMIT" VALUE="Upload" class="button">
</FORM>

ElseIf Request.Form("type") = "scripts" Then

<FORM METHOD="POST" ACTION="upload/scripts_upload.asp" ENCTYPE="multipart/form-data">
<INPUT TYPE="FILE" NAME="FILE1" SIZE="50" class="textfields">
<INPUT TYPE="FILE" NAME="FILE2" SIZE="50" class="textfields">
<INPUT TYPE="FILE" NAME="FILE3" SIZE="50" class="textfields">
<INPUT TYPE="FILE" NAME="FILE4" SIZE="50" class="textfields">

<INPUT TYPE="SUBMIT" VALUE="Upload" class="button">
</FORM>

Else

<FORM Method=Post>
Files: <INPUT Type=Radio Name=type Value=files>
Scripts: <INPUT Type=Radio Name=type Value=scripts>
<INPUT Type=Submit class="button" value="Change">
</FORM>

End If
%>
</td></tr>
<tr><td><img src="spacer.gif" width="1px" height="10px"></td></tr>
<tr><td align="center"><!--#include virtual="adrotator/adrotator_468x60.asp" --></td></tr>
<tr><td align="center"><!--#include file="footer.asp"--></td></tr>
</table>
</td><td align="right" valign="top"><table border="0" style="border-collapse: collapse" width="160px" height="600px"><tr><th background="ad_title_bg.jpg">Advertisment</th></tr>
<!-- AD -->
<td width="160px" background="120x600ad_bg.jpg" align="center">
<div style="border:thin dashed white">
<table border="0" style="border-collapse: collapse">
<tr><td>
<!--#include virtual="adrotator/adrotator_160x800.asp" --> </td></tr>
</td></table></div>
<!-- AD -->
</td></tr>
</table>
</body>
</html>
====================================

I get this error:
----------------------
Microsoft VBScript compilation error '800a0400'

Expected statement

/upload_changer.asp, line 24

<FORM METHOD="POST" ACTION="upload/files_upload.asp" ENCTYPE="multipart/form-data">
__________________
http://www.streamsearch.ca - Live stream search engine. Find radio stations to listen to and TV channels to watch!

http://www.machonemedia.ca - Mach One Media web development and media services.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 08-17-03, 10:49 AM
Shane Shane is offline
Coding Addict
 
Join Date: Jun 2003
Location: Maryland, US
Posts: 268
Thanks: 0
Thanked 0 Times in 0 Posts
You can't put regular HTML between the ASP brackets. You have to either close them off, or do a response.write.

For example:

Code:
<%
If condition = "yes" then
%>
<form method="post" action="whatever.asp">
<!-- more html here -->

<%
Else
%>
<!-- more html here
<% 
End If
%>
__________________
Shane Bauer
Microsoft Certified Professional (MCP) - ASP.NET
ASP/ASP.net, C#, VB/VB.NET, PHP, Perl, SQL
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -5. The time now is 01:06 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.