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

Please help me i am trying to upload new link on the webpage. It shoul 1

Status
Not open for further replies.

shailsonia

Programmer
May 5, 2004
5
US
Please help me i am trying to upload new link on the webpage. It should display the new one and delete the previous one.

I am copying my code please let me know where I am wrong


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>TCF Investments - Upload Product Grids to the Intranet</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv='EXPIRES' CONTENT='0'>
<meta http-equiv='Pragma' CONTENT='no-cache'>
<link rel=STYLESHEET href='/styles/standard.css' type='text/css'>

</head>

<body bgcolor="#FFFFFF" class="twelvePtGeneral">


<!-- Begin table to frame page in 800 wide page -->

<table width="760" align="center" border="0" cellpadding="3" cellspacing="0">
<tr>
<td>

<!-- Place entire page inside of this table cell -->

<!-- Begin page header -->
<table width="100%" height="80" border="0" cellpadding="0" cellspacing="0">
<tr valign="bottom">
<td width="180"">
</td>
<td>&nbsp;</td>
</tr>
</table>
<table width="100%" height="18" border="0" cellpadding="0" cellspacing="0" >
<tr>
<td class="HighlightedHeader" height="100%"><div align="left">
<!--#include virtual="/SSI/welcomeMessage.asp"--></div>
</td>
<td class="HighlightedHeader" height="100%"><div align="right">
<!--#include virtual="/SSI/loginLink.asp"--></div>
</td>
</tr>
</table>
<!-- End page header -->


<%

Dim fso, strFilePath, strDirectory, strFileName



' Object creation
' ***************
Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")


' Upload
' ******
mySmartUpload.Upload

strDirectory = "D:\Web Content\IntranetSite\soniatestserveruploaded\"
strFileName = mySmartUpload.Files.Item(1).FileName
strFilePath = strDirectory & strFileName


'Session("Uploaded_ProdGrid_File_Name") = mySmartUpload.Files.Item(1).FileName


' Save the file to a directory on the web server with a new name
' ************************************************************************************
mySmartUpload.Files.Item(1).SaveAs(strFilePath)

For each file In mySmartUpload.Files

Response.Write(file.FileName & " (" & file.Size & "bytes)<BR>")

h = file.FileName

Next





' Verify that the file was uploaded and saved
' *******************************************
Set fso = CreateObject("Scripting.FileSystemObject")

If fso.FileExists(strFilePath) then
'File was successfully uploaded
Response.Write("<BR><CENTER><h3>The file has been posted to the Intranet.</h3><br><br>")
Else
Response.Write("Error in Uploading")
' Response.Redirect "uploadtestlink.htm"
End If
%>



<!-- End of page content -->

</td>
<tr>
</table>

<!-- End of table -->


</body>
</html>

Thanks

Sonia
 
Please help me I am trying to insert records in sql server database through Asp page.

dim fsys
stitleID = 5
stitleName = Request.QueryString("Text")
stitle = Request.QueryString("FILENAME")
sdate = Request.QueryString("now()")
response.write(stitleName)
set fsys = Server.CreateObject("Scripting.FileSystemObject")




' Verify that the file was uploaded and saved
' *******************************************
Set fso = CreateObject("ADODB.Recordset")

'getting the values
SQLText = "INSERT INTO updatelink VALUES(stitleID, stitleName, stitle, sdate)"
objCommand.CommandText =SQLText
objCommand.Execute(SQLText)

objCommand.CommandText ="Select * from updatelink"
'objCommand.CommandType = 1

fso.open objCommand


'titleid=fso("titleid")
'title=fso("title")
response.write("objCommand")


'check to see if there were any errors

' This code puts fieldnames into column headings
response.write "<tr>"

%>
<%
' Now lets grab all the records
DO UNTIL fso.eof
' put fields into variables
titleid=fso("titleid")
title=fso("title")

' write the fields to browser
cellstart="<td align=""top"">"
response.write "<tr>"
response.write cellstart & titleid & "</td>"
response.write cellstart & title & "</td>"

response.write "</tr>"
fso.movenext
LOOP

If err.number=0 Then
response.write "the data was inserted successfully."

End If


%>



I am getting this error
Error Type:
Microsoft OLE DB Provider for SQL Server (0x80040E14)
The name 'stitleID' is not permitted in this context. Only constants, expressions, or variables allowed here. Column names are not permitted.
 
frist hing I see in error is this

sdate = Request.QueryString("now()")

you cannot have a built in function in quotes and I doubt you passed the function via QueryString

so try

sdate = now()

___________________________________________________________________

The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page faq333-3811
 
next error
Set fso = CreateObject("ADODB.Recordset")

to
Set fso = Server.CreateObject("ADODB.Recordset")

looks like you may be confused between FSO and ADODB

I may be way off cause that is kind of out there though

try changing
set fsys = Server.CreateObject("Scripting.FileSystemObject")

to
set fsys = Server.CreateObject("ADODB.Connection")


whats going on in this app???

there are a bunch of oddities up there I don't understand. The logic seems a bit weird. details? :)

___________________________________________________________________

The answer to your ??'s may be closer then you think.
Check out Tek-Tips knowledge bank by clicking the FAQ link at the top of the page faq333-3811
 
And this:

SQLText = "INSERT INTO updatelink VALUES(stitleID, stitleName, stitle, sdate)"


Should be

SQLText = "INSERT INTO updatelink VALUES('"&stitleID&"', '"&stitleName&"', '"&stitle&"', '"&sdate&"')"

-VJ
 
I am trying to upload link, I want to save the link path in my table. I don't know how to save the link and display the link on main page.
Please help!!!!

I have 2 pages. One to display all the links, one to browse new link .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top