Adding a progress bar to image and document uploads

Last post 05-20-2004, 7:43 AM by eastwood. 5 replies.
Sort Posts: Previous Next
  •  01-21-2004, 11:49 AM 243

    Adding a progress bar to image and document uploads

    Is there a way to add a progress bar when images or documents are being uploaded. RIght now, users dont have any indication as to how far things have progressed when they are uploading images or documents.

     

  •  01-31-2004, 1:49 PM 277 in reply to 243

    Re: Adding a progress bar to image and document uploads

    I have done this by using a component I already have installed on my Server.

     

    I use ASPUpload and ASPJPEG.

     

     http://www.aspupload.com

     

    I rewrote the code to use this so you get a progress bar and the ability to resize images to a max size which i have set in the code using the ASPJPEG object.

     

    If you want an example let me know and I will send you alink to see how it looks.

     

    If you want the site hosted, I can help

  •  05-15-2004, 11:38 PM 853 in reply to 277

    Re: Adding a progress bar to image and document uploads

    If you do not mind I would be interested in seeing the code to this as well.  If sounds as though you have found some nice ways to enhance cute editor.
  •  05-19-2004, 11:06 AM 865 in reply to 853

    Re: Adding a progress bar to image and document uploads

    its not that easy to show cos it would mean putting up a demo version of my web manager and at the mo i dont have the time a sI am stacked with worked.

     

    I am planning on putting a sample manager up on my web site when i get 5 mins

     

    sorry

     

    if you are desperate I can put scren shots up if you like?

  •  05-19-2004, 4:21 PM 870 in reply to 865

    Re: Adding a progress bar to image and document uploads

    If you replaced the code in the upload script could you cut and paste the code you used to provide the progress bar removing any proprietary information?  Whenever you get a moment. No rush.
  •  05-20-2004, 7:43 AM 871 in reply to 870

    Re: Adding a progress bar to image and document uploads

    There are 2 change si made to the code

     

    taken from upload.asp (renamed upload2.asp to save original code)

    ***************************************************

    <html>
     <head>
      <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
      <title>Upload Page</title>
     </head>

    <%
    Set UploadProgress = Server.CreateObject("Persits.UploadProgress")
    PID = "PID=" & UploadProgress.CreateProgressID()
    barref = "framebar.asp?to=10&" & PID
    %>

    <SCRIPT LANGUAGE="JavaScript">
    function ShowProgress()
    {
      strAppVersion = navigator.appVersion;
      if (document.f.uploadimage.value != "")
      {
     if (strAppVersion.indexOf('MSIE') != -1 && strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4)
     {
       winstyle = "dialogWidth=375px; dialogHeight:130px; center:yes";
       window.showModelessDialog('<% = barref %>&b=IE',null,winstyle);
     }
     else
     {
       window.open('<% = barref %>&b=NN','','width=370,height=115', true);
     }
      }
      return true;
    }
    </SCRIPT>

     <body bgcolor="buttonface">
     <%
      Dim ImageGalleryPath,MaxImageSize
      ImageGalleryPath = Request.QueryString("GP")
      MaxImageSize = Request.QueryString("MaxImageSize")
     %>

      <form action="filePost2.asp?GP=<%=ImageGalleryPath%>&MaxImageSize=<%=MaxImageSize%>&<%=PID %>" enctype="multipart/form-data" method="post" name="f" id="f" OnSubmit="return ShowProgress();">
       <table border="0" style="font-family: MS Sans Serif; font-size: 9pt; vertical-align: top;" cellspacing="2" cellpadding="0" width="100%" align="center" ID="Table1">
        <tr>
         <td>
          <input type="file" name="uploadimage" size="25" maxlength="50" />
         </td>
        </tr>
        <tr>
         <td>
          &nbsp;&nbsp;<input type="submit" value="Upload" />
         </td>
        </tr>
       </table>
      </form>
     </body>
    </html>

     

    ***************************************************

    taken from filepost.asp (renamed filepost2.asp to save original code)

     

    ***************************************************

    <%
    Dim Count
    Dim Upload
    Dim strfilepath
    Dim File
    Dim ImageGalleryPath
    Dim MaxImageSize

     On Error Resume Next
     Server.Scripttimeout = 20000
     errMsg = ""

     ImageGalleryPath = Server.MapPath(Request.QueryString("GP"))
     MaxImageSize = (Request.QueryString("MaxImageSize")*1024)

     Set Upload = Server.CreateObject("Persits.Upload")
     Upload.ProgressID = Request.QueryString("PID")
     strfilepath = filePath
     Upload.OverwriteFiles = False
     Count = Upload.Save(ImageGalleryPath)

     If Err.Number = 8 Then
      errMsg = "<font color=red><b>Your file is too large. Please try again.</b></font>"
     Else
      For Each File in Upload.Files
       strFile = File.ExtractFileName

       Select Case File.ImageType
        Case "GIF","JPG"
        Case Else
         errMsg = "<font color=red><b>File format not supported! - Supported Files (JPG,GIF)</b></font>"
         File.CopyVirtual ImageGalleryPath & File.FileName
         File.Delete
         Exit For
       End Select
      Next
     End If
    %>

    <html>
    <head>
     <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
    </head>
    <body bgcolor="buttonface" style="font-family: MS Sans Serif; font-size: 9pt; vertical-align: top;">
    <%
     if errMsg = "" then
      Response.Write strFile &" uploaded successfully!"%>
      <script>parent.frames['browse_Img'].Editor_upfolder('browse_Img');</script>
    <% else
      Response.Write errMsg
     end if
    %>
     <br><br>
     <a style="font-family: MS Sans Serif; font-size: 9pt; vertical-align: top; cursor: hand;" href="upload.asp?GP=<%=ImageGalleryPath%>&MaxImageSize=<%=MaxImageSize%>">Upload again</a>
    </body>
    </html>
    ****************************************************

    Any questions just shout

View as RSS news feed in XML