Dreamweaver and ASPUpload

Posted on 2006-05-04
Last Modified: 2008-09-22
I have a question.
I have the following form and i'm using Extension ASPUpload to change pictures.  Everything is working fine except that when the upload works, it doesn't show my new picture.  The old picture is still there and you have to hit the refresh button in the browser to show the new picture.  Is there a way to automatically refresh after everything takes place?

Here is the code.


<!--#include file="../Connections/inah_SQL.asp" -->
Dim RS1Member__MMColParam
RS1Member__MMColParam = "1"
If (Request.QueryString("MemberID") <> "") Then
  RS1Member__MMColParam = Request.QueryString("MemberID")
End If
Dim RS1Member
Dim RS1Member_numRows

Set RS1Member = Server.CreateObject("ADODB.Recordset")
RS1Member.ActiveConnection = MM_inah_SQL_STRING
RS1Member.Source = "SELECT * FROM dbo.inah_member WHERE MemberID = " + Replace(RS1Member__MMColParam, "'", "''") + ""
RS1Member.CursorType = 0
RS1Member.CursorLocation = 2
RS1Member.LockType = 1

RS1Member_numRows = 0

'*                               *
'*  ONLY UPLOAD                  *
'*         *
'*                               *
      server.ScriptTimeout = 5400

      Dim RG_Connection, RG_editColumn, RG_recordId, Form, editAction, editRedirectUrl, RG_Files, RG_formName, UploadType, ParamVal, ParamList, MaxFieldNumber, TmpVal, x, y, Key, ProgressBar, UploadStatus, NumFile
      Dim RG_altVal, RG_columns, RG_Cong, RG_dbValues, RG_dbValuesTmp, RG_delim, RG_editCmd, RG_editQuery, RG_editQueryTmp, RG_emptyVal, RG_Ext, RG_Extensions, RG_fields, RG_FieldValueTmp, RG_FileDel, RG_FileExt, RG_formVal, RG_FS, RG_i, RG_L, RG_Len, RG_Max, RG_Name, RG_New, RG_newName, RG_Num, RG_Path, RG_Rec, RG_ret, RG_Save, RG_tableValues, RG_tableValuesTmp, RG_tst, RG_typeArray, RG_z
      Dim tmpField_Name(), tmpValue_Name(), tmpField_Size(), tmpValue_Size(), QtyRecord, TotalFileSize, valueToRedirectSend

      Set Form = New ASPForm
      UploadID = Form.NewUploadID
      ProgressBar = ""
      TotalFileSize = ""
      editRedirectUrl = "memberpicture.asp"
      RG_Files = ";3;;.jpg, .gif, .jpeg, .bmp;;0;;1;;;;-1;;;;;;Pic1FileAdd@_@_@0@_@_@ @_@_@@_@_@../"
      RG_formName = "form1"
      UploadStatus = ""
      valueToRedirectSend = "MemberID"
      NumFile = 0

      if len(Request.QueryString("UploadID"))>0 then
            Form.UploadID = Request.QueryString("UploadID")
      end if
      if (Request.QueryString <> "") Then
             editAction = CStr(Request.ServerVariables("SCRIPT_NAME")) & "?" & Request.QueryString & "&UploadID=" & UploadID
             editAction = CStr(Request.ServerVariables("SCRIPT_NAME")) & "?UploadID=" & UploadID      
      End If
Const fsCompletted  = 0

If Form.State = fsCompletted Then
  if Form.State = 0 then
            Set ParamVal = CreateObject("Scripting.Dictionary")
            tmp = split(RG_Files,"@_@_@")
            ParamList = split(tmp(0),"|")
            MaxFieldNumber = ubound(ParamList)
            for x=0 to Ubound(ParamList)
                  TmpVal = Split(ParamList(x),";")
                  for y=0 to ubound(TmpVal)
                        Key = right("00" & cstr(x),3) & cstr(y)
                        ParamVal.add Key, TmpVal(y)
  End If
ElseIf Form.State > 10 then
  response.write "<br><Font Color=red>Some form error.<br>Error code: " & Form.State & "<br>Error List:<br>0  Form was successfully processed. <br>1  Request method is NOT post <br>2  Zero length request (there are no data in a source form) <br>3  Form is in a middle of process. <br>5  Initial form state <br>11  Boundary of multipart/form-data is not specified. <br>12  Unknown source form (Content-type must be multipart/form-data) <br>15  Client was disconnected before upload was completted.<br>16  Unexpected error from Request.BinaryRead method (ASP error).<br></Font><br>"
End If

function GetFolderName(str): select case Str: case "Pic1FileAdd": Ris = server.MapPath("/images/memberpics/" & UploadFormRequest("MemberID")): end select: GetFolderName = Ris : end function

function myGetFileName(str): select case Str: case "Pic1FileAdd": Ris = UploadFormRequest("MemberID") & "a": end select: myGetFileName = Ris : end function
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="pragma" content="no-cache"; charset=iso-8859-1"/>
<title>Member Pictures</title>

<body bgcolor="#FFFFFF">

<!--#INCLUDE FILE="../member/memberheader.asp"-->
<font face="Arial">
<table width="80%" border="0" align="center" bgcolor="#FFFFCC" id="table1">
      <td align="right" colspan="3" bgcolor="#FFFFCC"></td>
            <td bgcolor="#FFFFCC">
            <p align="center"><font face="Arial">Member # <b><%=(RS1Member.Fields.Item("MemberID").Value)%></b> Website Information</font>                  </td>
            <td bgcolor="#FFFFCC"><div align="center"><font face="Arial"><i><font size="2">Please update your member website below</font></i></font>
         <td bgcolor="#FFFFCC">
             <font face="Arial" size="2" color="#FF0000">
             <p align="center"><a href="membermain.asp?Email=<%=(RS1Member.Fields.Item("Email").Value)%>&Pass1=<%=(RS1Member.Fields.Item("Pass1").Value)%>">
             <font color="#FF0000">&lt;&lt; Back to Member Main</font></a></font></td></tr></table>

<table width="90%" border="0" align="center" bgcolor="#FFFFFF" id="table2">
      <form ACTION="<%=editAction%>" onsubmit="return ProgressBar()" method="post" name="form1" id="form1" enctype="multipart/form-data">
      <tr valign="baseline">
      <td align="right">This is your current Picture 1:<br>
          <font face="Arial" size="2">
            <img border="0" src="../images/memberpics/<%=(RS1Member.Fields.Item("MemberID").Value)%>/<%=(RS1Member.Fields.Item("MemberID").Value)%>a.jpg" alt="No Picture Uploaded Yet" width=200 height=150></font></td>
         <td width=20>&nbsp;</td>

            <font face="Arial"><br />
            Change/Add Picture 1: </font><br />
            <input name="Pic1FileAdd" type="file" onchange="dwz_setEvent(this,'change')" onclick="dwz_setEvent(this,'click')" >
            <br />
            <br />
            <input type="hidden" name="MemberID" value="<%=((RS1Member.Fields.Item("MemberID").Value))%>">
            <input type="submit" name="Submit" value="Update Your Picture 1">

            <tr valign="baseline">
              <td nowrap align="right"></td>
              <td><div align="left"></div></td>

<font face="Arial">
<!--#include file="../dwzUpload/Upload.asp" -->
<!--#include file="../dwzUpload/UploadAdvanced.asp" -->
Set RS1Member = Nothing

Thanks, Austin
Question by:USCBigRed
    LVL 3

    Expert Comment

    try put this on the frist line of the page

    it will force the file to reload every time

    Author Comment

    that still doesn't work.  I tried it inside the <HEAD> tags and at the top line.  It doesn't refresh the pictures on the page unless I hit the Refresh button on the browser.  How can I do that automatically without having the user have to hit the button.  Even if the page flashes, it wouldn't matter to me.

    LVL 3

    Accepted Solution


    <form name="redirect" method="post">
    <SCRIPT language="javascript">
          function redirect(){
           setTimeout('document.forms[0].submit();', 10);


    <meta http-equiv="refresh" content="2">
     but make sure do a if else so they don't come out every time. and only show went refresh is needed.

    Author Comment

    Thanks so much!!

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Join & Write a Comment

    I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to …
    Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now