Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_components thread: Help with SmartUpload


Message #1 by "Lien M. Vu" <vulien@y...> on Tue, 24 Oct 2000 17:18:27 +0100
Hi everyone,



This is my first time posting to this forum, I apologize in advance if I am posting it incorrectly.  I need some help trying to get
SmartUpload to work, I want to be able to upload file from my computer to the server.  After reading and testing the example that
came with SmartUpload(it works fine), I decided to implement it with the codes that were written by someone else.  When I test it, I
got the following messages:



Error Type:

aspSmartUpload (0x800A0009)

Subscript out of range



the error is pointing to this line of code:



mySmartUpload.Upload



I am posting the codes below:



Upload.asp



	<%@ LANGUAGE="VBSCRIPT" %>



	<%Option Explicit%>

  		<!--#include file="nocache.asp"-->

	<% 

	

	Response.buffer = true 

		

		if session("logon")=false then

			Response.Redirect("logon.htm")

		end if

		

		session("currentpage")=9

	

	Dim mySmartUpload

	

	Dim strServerURL  'Local Web Server Name including http:// protocol

	Dim strTargetURL  'Directory where we will upload our file to

	Dim strRepostURL  'Path to the page we will display after our file uploads

	Dim strPathToPA   'Path to the cpshost.dll

	Dim strPostingURL 'Action path for our form



	strServerURL = "http://" + Request.ServerVariables("SERVER_NAME")

	strTargetURL = strServerURL & "/LocalInv"

	strRepostURL = strServerURL & "/afterlocalupload.asp"

	strPathToPA =  strServerURL & "/Scripts/cpshost.dll"

	strPostingURL = strPathToPA + "?PUBLISH?" + strRepostURL

	

	' Object Creation

	Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")



	mySmartUpload.Upload

	mySmartUpload.Save("strTargetURL")

%>

	<SCRIPT LANGUAGE="JavaScript" SRC="Javascript/func.js"></SCRIPT>

<SCRIPT Language="javascript">



	function uploaddata(){

		

		var localinv

		

		localinv = document.getElementById('localinv')

		

		if (localinv.value == "" || localinv.value == null){

			alert("You Must Locate the File Before You Can Upload It")

			return

			}

		

		document.frmlocalinv.submit()

		}





</SCRIPT>



<HTML>

<BODY>



<FORM name="frmlocalinv" id="frmlocalinv" enctype="multipart/form-data" action="<% = strPostingURL %>" method="post">



<input type="hidden" name="TargetURL" value="<% = strTargetURL %>">



<TABLE cellpadding=0 cellspacing=0 border=0>

<TR Height=25></TR>

<TR>

	<TD width=25></TD>

	<TD><FONT Size=3><B>On this page you can upload your local inventory from the EMDL Rev. 19 or Rev.
20</B></FONT></TD>

	<TD></TD>

	</TR>

<TR>

	<TD width=25 height=25></TD>

	<TD><FONT Size=2></FONT></TD>

	<TD></TD>

	</TR>

<TR>

	<TD width=25 height=25></TD>

	<TD><FONT Size=2><B>Step 1:<B></FONT></B></B></TD>

	<TD></TD>

	</TR>

<TR>

	<TD width=25 height=25></TD>

	<TD><FONT Size=2>Use the Browse Button to Locate The File "</FONT><FONT color=blue size=2 title="Normally this
is located in C:\EMDLWIN">DET_INV.DBF</FONT><FONT size=2>"</FONT></TD>

	<TD></TD>

	</TR>

<TR>

	<TD width=25 height=25></TD>

	<TD><INPUT type=file name=localinv id=localinv size=50></TD>

	<TD></TD>

	</TR>

<TR>

	<TD width=25 height=25></TD>

	<TD></TD>

	<TD></TD>

	</TR>

<TR>

	<TD width=25 height=25></TD>

	<TD><FONT Size=2><B>Step 2:</B></FONT></TD>

	<TD></TD>

	</TR>

<TR>

	<TD width=25 height=25></TD>

	<TD><FONT Size=2> Press the Upload Button below</FONT></TD>

	<TD></TD>

	</TR>

<TR>

	<TD width=25 height=25></TD>

	<TD><INPUT type=button value="Upload" name=updata id=udata style="width:75" onclick="uploaddata()">

	    <INPUT type=reset value="Reset" name=submitform id=submitform style="width:75">

	    <Input type=button value="Cancel" name=cancel id=cancel onclick="location.href='utilities.asp'"
style="width:75"></TD>

	<TD></TD>

	</TR>

	</TABLE>

</FORM></BODY></HTML>


  Return to Index