Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - need help with some asp code...
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

need help with some asp code...

 Post Reply Post Reply
Author
cheops@collecto View Drop Down
Groupie
Groupie


Joined: 14 January 2004
Location: Denmark
Status: Offline
Points: 53
Post Options Post Options   Thanks (0) Thanks(0)   Quote cheops@collecto Quote  Post ReplyReply Direct Link To This Post Topic: need help with some asp code...
    Posted: 21 January 2004 at 6:54pm

Hi I need some help from a good ASP and JavaScript, person.

This is what I have and – what I would like it to be -

1.    I have a folder with images and files.
2.    I have an asp file with some text, textbox and editing possibilities for these.

I need a Folder file viewer/listing code – that can display all the file names on the same asp page.

when you click on one of the images/or files, the image/file name will be transferred to the text box/field, ready to save to database with the new image/file name…

Is this to complicated… I have this piece of code:

[Code start]

<script language="JavaScript" type="text/JavaScript"> function sendText(e, text) { e.value = text } </script> </head> <body marginwidth="0" marginheight="0" leftmargin="0" topmargin="0" bgcolor="#FFFFFF"> <table width="29%" height="292" border="0" align="center" cellpadding="4" cellspacing="2"> <tr> <td width="100%" height="210" colspan="2" valign="top"> <div align="center"><img name="image" width="300" height="200" onClick="sendText(document.form1.taupdate, 'got it working I see... :)')"></div></td> </tr> <tr> <td height="80" colspan="2" valign="top"><form name="form1" method="post" action=""> <div align="center"> <textarea name="taupdate" cols="30" id="taupdate"></textarea> </div> </form></td> </tr> </table>

[Code end]

Sending the file name to the form field

and I have this piece of code:


[Code start]
<script language="JavaScript">
  function confirm_delete(intSectionID)
   {
   if (confirm("Are you sure that you would like to delete this file?"))
    {
    document.location = "images.asp?Action=Delete&File=" + intSectionID ;
    }
   }
</script>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<%
ImagesPath = "images/"

If Request.QueryString("Action") = "Delete" Then
 Dim strImage
 
 strImage = ImagesPath & Request.QueryString("File")
 response.write(server.mappath(strImage))
 Set objFSO = CreateObject("Scripting.FileSystemObject")
 objFSO.DeleteFile(server.mappath(strImage))
 objFSO.Close
 Set objFSO = Nothing
End If
%>

<table border="0" cellpadding="0" cellspacing="0" width="400" align="center">
  <tr>
   <td align="left" width="10"><img src="../images/left.gif" width="8" height="20" border="0" alt=""></td>
   <td width="100%"  align="center">Image Management</td>
   <td align="right" width="10"><img src="../images/right.gif" width="8" height="20" border="0" alt=""></td>
  </tr>
  <tr>
   <td colspan="3" valign="top">
    <table border="0" width="100%" bgcolor="#000000" cellpadding="0" cellspacing="1" valign="top">
     <tr>
      <td bgcolor="#fffff0" valign="top">
       <table cellpadding="0" cellspacing="0" border="0" width="100%">
        <tr>
         <td>
          <table width="100%" border="0" align="left" cellpadding="3" cellspacing="0">
               <tr align="left" valign="top">
                <td width="155"><font class="Bold">File Name</font></td>
                <td width="55" align="center"><font class="Bold">Size</font></td>
                <td align="center"><font class="Bold">Date</font></td>
             <td align="center"><font class="Bold">Actions</font></td>
               </tr><%
               Dim objFSO 'File System Object
               Dim objFile 'File Object
               Dim objFolder 'Folder Object
               Set objFSO = CreateObject("Scripting.FileSystemObject") 'Create File System Object To Get list of files
               Set objFolder = objFSO.GetFolder(server.mappath(ImagesPath)) 'Set the object folder To the mapped path
               'For Each file In the folder
               For Each objFile In objFolder.Files
             if objFile.Name <>  "blank.gif" then %>
                <tr align="left" valign="top">
                 <td>
              <b><%=objFile.Name%></b><br>
              <% response.write "<img src='" & ImagesPath & objfile.name & "

Sorry for my bad 3nglish..!!
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.