This forum is a community forum meant for users of the plugin to collaborate and help solve issues with implementation, etc. Unfortunately, as the creator of the plugin, I do not have much time to attend to every request here as this is only a side project and I must work a full-time job to provide for my family. This is how I keep the Flash version free and the HTML5 version low cost.
UploadiFive 1.1.1 has been released which includes a small fix for added support on touch devices including iOS 6 devices.
Uploadify with classic .asp
  • Has anyone used Uploadify with classic .asp (not asp.net)? I haven't seen any examples on the site or in the forums, but surely someone has done this.

    Thanks in advance.
  • I'm working on a classic asp program now. They don't make it easy to follow the docs...what docs?
  • I'm working with classic ASP, using the JScript language on the server (ver 5.7.16599), IIS 5.1 on Windows XP Pro, Firefox 3.08 w/flash 9.0 r124 and IE 7.0.5730.11 w/flash v10.a, and JQuery 1.3.2.

    I'm having trouble with uploadify 2.0.x in several ways:
    1. The example code mostly works (the rollover button doesn't in either IE 7 or FF 3.08)
    2. When the upload works it doesn't display progress
    3. The new version requires complete URL paths (partial paths don't seem to work like images/cancel.png or in the stylesheet link refs). Did that change in v2.0.3? My link refs for jQuery are just partially specified, thus I don't need to change them for deployment on the hosting service machines).

    I really like uploadify in terms of it's capabilities and flexibility of the UI design. However, its a bit disappointing in that it seems somewhat brittle or unreliable.

    I'm definitely not ruling out it may be all my own fault, but when I use the example page as a staring point and try to apply it to my application, it stops working.

    I had it working pretty well with 1.6.2, all except I wanted to just display the cancel button and the percentage to the left of it as the download occurred. I couldn't get them both to stay on one line. So I tabled that issue and moved on. I'm using uploadify in 3 places, all with a tabbed interface, and one in a css popup form.

    When I came back to resolve remaining uploadify issues & clean up I discovered v2.0.3 was out. I also had made significant changes to my design (employing more ajax) and thus I had to rework the script includes.

    I noticed when using the uploadify example demo that some of the html objects aren't created until the download is started. I put an alert in the onSelectedOnce callback to make it easier to inspect these dynamic elements with Firebug. Even the fileQueue seems to created dynamically (or did that change with 2.0.x?)

    I suspect the issues I'm now having are related to CSS. I tried to go back to 1.6.2 but the problem I'm now seeing with that version is that sometimes it works and sometimes it doesn't. I guess that's one reason for the new swfobject.js script. Man, it sure seems like alot of code to just detect if flash is installed.

    Because of the complexity of my site's design I'm not sure I can post enough code here to be useful in diagnosing the problem. But if I'm right about CSS being at the root of it it might be fairly easy to spot the problem. So here is the CSS I'm adding to my primary stylesheet for uploadify:

    I'm including the various scripts in this order:
    In the main gateway page load:
    <script src=\"javascript/jquery-1.3.2.min.js\" type=\"text/javascript\"></script>
    <script src=\"javascript/tools.tabs-1.0.1.js\" type=\"text/javascript\"></script>
    <script src=\"javascript/tools.expose-1.0.3.js\" type=\"text/javascript\"></script>
    <script src=\"javascript/tools.tooltip-1.0.2.js\" type=\"text/javascript\"></script>

    in the tab content portion:
    <script type=\"text/javascript\" src=\"http://localhost/ozcoins/swfobject.js\"></script>
    <script type=\"text/javascript\" src=\"http://localhost/ozcoins/javascript/jquery.uploadify.v2.0.3.min.js\"></script>

    And here's the CSS, loaded in the HEAD before any javascript:
    /* --------------------------------
    UPLOADIFY JQUERY PLUGIN STYLES
    --------------------------------
    .uploadifyQueueItem {
    font: 11px Verdana, Geneva, sans-serif;
    border: 0px solid transparent;
    margin-top: 0px;
    padding: 0px;
    width: 75px;
    }
    .uploadifyError {
    border: 2px solid #FBCBBC !important;
    background-color: #FDE5DD !important;
    }
    .uploadifyQueueItem .cancel {
    margin-right: 5px;
    float: left;
    top: 0px;
    }
    .uploadifyProgress {
    margin-top: 0px;
    display: none;
    }
    .uploadifyProgressBar {
    height: 0px;
    }
    #fileQueue {
    width: 100px;
    height: 18px;
    overflow: hidden;
    margin: 0px;
    }

    And here's the init code:
    $('#uploadTab').uploadify ({
    'script' : 'http://localhost/xxxx/uploader.asp',
    'uploader' : 'http://localhost/xxxx/uploadify.swf',
    'cancelImg' : 'http://localhost/xxxx/images/cancel.png',
    'folder' : 'ignored',
    'queueID' : 'fileQueue',
    'auto' : true,
    'multi' : true,
    // 'sizeLimit' : 100000,
    'fileDesc' : \"*.gif, *.jpg, *.png\",
    'fileExt' : \"*.gif;*.jpg;*.png\"

    // 'onSelect' : fileSelected,
    // 'hideButton': false,
    // 'buttonImg': \"http://localhost/xxxx/images/upload1.gif\",
    // 'rollOver' : false, // Doesn't work at all !
    // 'width' : \"70px\",
    // 'height' : \"15px\"
    });


    I commented out various items in the init code for testing. I've never gotten the button rollever to work, in either flash 9 on FF or flash 10 in IE. I'm using an old version of Paint Shop Pro (6.0), so I don't think it supports the 24 bit PNG format. But I saw nothing in the docs that said that was required either.
  • first off the rollover.
    You have rollOver it should be rollover (all lowercase)

    swfobject. yes we did change uploadify to use swfobject due to the number of issues people were having with the basic flash detection methods originally used.

    css
    .uploadifyProgress - you have it set to display: none, obviously it will never display until it is set back to block.
    .uploadifyProgressBar - you have the height set 0px. This means it has no also will not display.
    look at the original uploadify.css class settings

    partial paths do work. placing a '/' at the front of your paths will force uploadify not to add any relative data to the path. leaving it off, means uploadify will assume it is a relative path and will add the relative path data to the path.

    All html Queue item elements are loaded dynamically when the files are selected, not when the file starts to upload. You have auto set to true, which will give the appearance of it adding the html when the upload starts.
  • I'll check on the rollover spelling, perhaps that's all it is.

    As for progress & filename I intend for those to not be displayed; all I want is the numeric progress and cancel img.

    As I mentioned, my site has grown rather complex. I discovered a child ">" operator in the jQuery tools tab css that was bleeding into the uploadify objects. The upload is now working, but I am still mystified at a few little problems I'm seeing.

    I moved all the uploadify css into separate external stylesheets. I'm not sure why certain things don't seem to show up tho, for example I put different colored borders on the fileQueue so I can tell which stylesheet is in use. But none of them show up, but other characteristics do such as the size of the fileQueue.

    I'm aware the queue name can be set with queueID, and I've used the !important flag in the css file too.

    I need 3 instances of uploadify, each one on a different tab or css popup form. One tab is devoted exclusively for image uploads, and I want uploadify to work just as in your examples with filename, progress bar etc. But even when I force the standard css file to be loaded, it doesn't behave that way.

    Anyway, I'm 99.9% certain it is a problem on my end, and I'll figure it out eventually. I appreciate your efforts in creating and supporting uploadify, its a great design.

    It does get a bit tricky to switch some of the UI items on and off dynamically through css though, but that's probably just because I'm not the best at it. I'll get there!
  • I still have no joy with the rollover setting. I started from the 2.0.2 example folder code in the 2.0.3 zip file.

    I used the browseBtn.png from some uploadify zip file I downloaded (3 images stacked, 80px X 24px).

    No matter what I tried it just didn't work at all in Firefox (flash 9). In IE (flash 10) it "scintilated" or flickered, but wasn't usable in my view. Sometimes when you move off the button it went invisible.

    I also discovered that if I don't define any button image the error I often see goes away.


    __flash__toXML(jQuery(\"#popUpload\").attr(\"height\",15px)()) ; } catch (e) { \"<undefined/>\";


    As I said when I initially posted this, I don't see how my code could cause this error, as the 15px (value from uploadify settings) isn't quoted at all. I tried to find that piece of code in the uploadify source files but couldn't. I don't have a flash compiler anyways.
  • I pretty much have things working now, with a few exceptions:

    1) Still have an issue with the height property not being quoted properly, but only in Firefox. I got around the problem (a bit of a hack) with: 'height' : ($.browser.msie ? "15px" : "'15px'") in the init code. My goal was not to make any changes to any of the uploadify code, and I have met that goal.

    2) I'd like to use a css styled browse button, but can't seem to figure out how to get the transparent uploadify button to lay on top of the underlaying button image / html I want to use. No matter what element I try to use, the transparent uploadify button displaces it; they don't want to occupy the same space. I've tried using css position, top, letf etc with no luck. An example would be nice to see how to do his. Great feature, but how to implement?

    3) The button image file seems to be dynamically resized, and that causes a delay in the button appearing, unlike the default flash button which responds instantly. Using Paint Shop Pro reveals the button image provided of 70px by 15px gets mapped on top of a field of 78px x 17px, probably the mask for the original INPUT element.

    4) The uploadify.uploadifyClearQueue doesn't stop active downloads or clear the queue. I put alerts before and after the call to the clear function, so I know it's getting there without errors.

    I notice that the uploadify button image doesn't always display when it should. If I refresh the page or repeat the steps at arriving to the problem page it usually appears. I really wish I could eliminate the delay caused by custom button images.
  • Could you post some code (server side). ie how to handle the upload in classic asp.

    Thanks
  • Sure. I googled & found this free code written in VB. Simple solution works OK for me. You mileage may vary as they say...
    Here is the asp file that uses the VB upload class. I use JScript (Javascript) whenever & where I can, especially over VB. For the sake of time I chose not to rewrite the VB class.


    <!-- #include file=\"uploader.cls\" -->
    <%
    'option explicit
    Response.Expires = -1
    Server.ScriptTimeout = 600

    Set Upload = New Uploader
    Upload.Save(Server.MapPath(\"images\"));
    Response.Write(\"<HTML><HEAD></HEAD><BODY></BODY></HTML>\"); // Some client code needs a response to finish
    %>



    And here is the uploader.cls included by above:

    %@ Language=VBScript%>
    <%
    ' For examples, documentation, and your own free copy, go to:
    ' http://www.freeaspupload.net
    ' Note: You can copy and use this script for free and you can make changes
    ' to the code, but you cannot remove the above comment.

    'Changes:
    'Aug 2, 2005: Add support for checkboxes and other input elements with multiple values
    'Jan 6, 2009: Lars added ASP_CHUNK_SIZE

    const DEFAULT_ASP_CHUNK_SIZE = 200000

    Class Uploader
    Public UploadedFiles
    Public FormElements

    Private VarArrayBinRequest
    Private StreamRequest
    Private uploadedYet
    Private internalChunkSize

    Private Sub Class_Initialize()
    Set UploadedFiles = Server.CreateObject(\"Scripting.Dictionary\")
    Set FormElements = Server.CreateObject(\"Scripting.Dictionary\")
    Set StreamRequest = Server.CreateObject(\"ADODB.Stream\")
    StreamRequest.Type = 2 ' adTypeText
    StreamRequest.Open
    uploadedYet = false
    internalChunkSize = DEFAULT_ASP_CHUNK_SIZE
    End Sub

    Private Sub Class_Terminate()
    If IsObject(UploadedFiles) Then
    UploadedFiles.RemoveAll()
    Set UploadedFiles = Nothing
    End If
    If IsObject(FormElements) Then
    FormElements.RemoveAll()
    Set FormElements = Nothing
    End If
    StreamRequest.Close
    Set StreamRequest = Nothing
    End Sub

    Public Property Get Form(sIndex)
    Form = \"\"
    If FormElements.Exists(LCase(sIndex)) Then Form = FormElements.Item(LCase(sIndex))
    End Property

    Public Property Get Files()
    Files = UploadedFiles.Items
    End Property

    Public Property Get Exists(sIndex)
    Exists = false
    If FormElements.Exists(LCase(sIndex)) Then Exists = true
    End Property

    Public Property Get FileExists(sIndex)
    FileExists = false
    if UploadedFiles.Exists(LCase(sIndex)) then FileExists = true
    End Property

    Public Property Get chunkSize()
    chunkSize = internalChunkSize
    End Property

    Public Property Let chunkSize(sz)
    internalChunkSize = sz
    End Property

    'Calls Upload to extract the data from the binary request and then saves the uploaded files
    Public Sub Save(path)
    Dim streamFile, fileItem

    if Right(path, 1) <> \"\\" then path = path &amp; \"\\"

    if not uploadedYet then Upload

    For Each fileItem In UploadedFiles.Items
    Set streamFile = Server.CreateObject(\"ADODB.Stream\")
    streamFile.Type = 1
    streamFile.Open
    StreamRequest.Position=fileItem.Start
    StreamRequest.CopyTo streamFile, fileItem.Length
    streamFile.SaveToFile GetFileName(path, fileItem.FileName), 2
    streamFile.close
    Set streamFile = Nothing
    fileItem.Path = path &amp; fileItem.FileName
    Next
    End Sub

    public sub SaveOne(path, num, byref outFileName, byref outLocalFileName)
    Dim streamFile, fileItems, fileItem, fs

    set fs = Server.CreateObject(\"Scripting.FileSystemObject\")
    if Right(path, 1) <> \"\\" then path = path &amp; \"\\"

    if not uploadedYet then Upload
    if UploadedFiles.Count > 0 then
    fileItems = UploadedFiles.Items
    set fileItem = fileItems(num)

    outFileName = fileItem.FileName
    outLocalFileName = GetFileName(path, outFileName)

    Set streamFile = Server.CreateObject(\"ADODB.Stream\")
    streamFile.Type = 1
    streamFile.Open
    StreamRequest.Position = fileItem.Start
    StreamRequest.CopyTo streamFile, fileItem.Length
    streamFile.SaveToFile path &amp; outLocalFileName, 2
    streamFile.close
    Set streamFile = Nothing
    fileItem.Path = path &amp; filename
    end if
    end sub

    Public Function SaveBinRequest(path) ' For debugging purposes
    StreamRequest.SaveToFile path &amp; \"\debugStream.bin\", 2
    End Function

    Public Sub DumpData() 'only works if files are plain text
    Dim i, aKeys, f
    response.write \"Form Items:<br>\"
    aKeys = FormElements.Keys
    For i = 0 To FormElements.Count -1 ' Iterate the array
    response.write aKeys(i) &amp; \" = \" &amp; FormElements.Item(aKeys(i)) &amp; \"<BR>\"
    Next
    response.write \"Uploaded Files:<br>\"
    For Each f In UploadedFiles.Items
    response.write \"Name: \" &amp; f.FileName &amp; \"<br>\"
    response.write \"Type: \" &amp; f.ContentType &amp; \"<br>\"
    response.write \"Start: \" &amp; f.Start &amp; \"<br>\"
    response.write \"Size: \" &amp; f.Length &amp; \"<br>\"
    Next
    End Sub

    Public Sub Upload()
    Dim nCurPos, nDataBoundPos, nLastSepPos
    Dim nPosFile, nPosBound
    Dim sFieldName, osPathSep, auxStr
    Dim readBytes, readLoop, tmpBinRequest

    'RFC1867 Tokens
    Dim vDataSep
    Dim tNewLine, tDoubleQuotes, tTerm, tFilename, tName, tContentDisp, tContentType
    tNewLine = String2Byte(Chr(13))
    tDoubleQuotes = String2Byte(Chr(34))
    tTerm = String2Byte(\"--\")
    tFilename = String2Byte(\"filename=\"\"\")
    tName = String2Byte(\"name=\"\"\")
    tContentDisp = String2Byte(\"Content-Disposition\")
    tContentType = String2Byte(\"Content-Type:\")

    uploadedYet = true

    on error resume next
    readBytes = internalChunkSize
    VarArrayBinRequest = Request.BinaryRead(readBytes)
    VarArrayBinRequest = midb(VarArrayBinRequest, 1, lenb(VarArrayBinRequest))
    for readLoop = 0 to 300000
    tmpBinRequest = Request.BinaryRead(readBytes)
    if readBytes < 1 then exit for
    VarArrayBinRequest = VarArrayBinRequest &amp; midb(tmpBinRequest, 1, lenb(tmpBinRequest))
    next
    if Err.Number <> 0 then
    response.write \"<br><br><B>System reported this error:</B><p>\"
    response.write Err.Description &amp; \"<p>\"
    response.write \"The most likely cause for this error is the incorrect setup of AspMaxRequestEntityAllowed in IIS MetaBase. Please see instructions in the <A HREF='http://www.freeaspupload.net/freeaspupload/requirements.asp'>requirements page of freeaspupload.net</A>.<p>\"
    Exit Sub
    end if
    on error goto 0 'reset error handling

    nCurPos = FindToken(tNewLine,1) 'Note: nCurPos is 1-based (and so is InstrB, MidB, etc)

    If nCurPos <= 1 Then Exit Sub

    'vDataSep is a separator like -----------------------------21763138716045
    vDataSep = MidB(VarArrayBinRequest, 1, nCurPos-1)

    'Start of current separator
    nDataBoundPos = 1

    'Beginning of last line
    nLastSepPos = FindToken(vDataSep &amp; tTerm, 1)

    Do Until nDataBoundPos = nLastSepPos

    nCurPos = SkipToken(tContentDisp, nDataBoundPos)
    nCurPos = SkipToken(tName, nCurPos)
    sFieldName = ExtractField(tDoubleQuotes, nCurPos)

    nPosFile = FindToken(tFilename, nCurPos)
    nPosBound = FindToken(vDataSep, nCurPos)

    If nPosFile <> 0 And nPosFile < nPosBound Then
    Dim oUploadFile
    Set oUploadFile = New UploadedFile

    nCurPos = SkipToken(tFilename, nCurPos)
    auxStr = ExtractField(tDoubleQuotes, nCurPos)
    ' We are interested only in the name of the file, not the whole path
    ' Path separator is \ in windows, / in UNIX
    ' While IE seems to put the whole pathname in the stream, Mozilla seem to
    ' only put the actual file name, so UNIX paths may be rare. But not impossible.
    osPathSep = \"\\"
    if InStr(auxStr, osPathSep) = 0 then osPathSep = \"/\"
    oUploadFile.FileName = Right(auxStr, Len(auxStr)-InStrRev(auxStr, osPathSep))

    if (Len(oUploadFile.FileName) > 0) then 'File field not left empty
    nCurPos = SkipToken(tContentType, nCurPos)

    auxStr = ExtractField(tNewLine, nCurPos)
    ' NN on UNIX puts things like this in the stream:
    ' ?? python py type=?? python application/x-python
    oUploadFile.ContentType = Right(auxStr, Len(auxStr)-InStrRev(auxStr, \" \"))
    nCurPos = FindToken(tNewLine, nCurPos) + 4 'skip empty line

    oUploadFile.Start = nCurPos+1
    oUploadFile.Length = FindToken(vDataSep, nCurPos) - 2 - nCurPos

    If oUploadFile.Length > 0 Then UploadedFiles.Add LCase(sFieldName), oUploadFile
    End If
    Else
    Dim nEndOfData
    nCurPos = FindToken(tNewLine, nCurPos) + 4 'skip empty line
    nEndOfData = FindToken(vDataSep, nCurPos) - 2
    If Not FormElements.Exists(LCase(sFieldName)) Then
    FormElements.Add LCase(sFieldName), Byte2String(MidB(VarArrayBinRequest, nCurPos, nEndOfData-nCurPos))
    else
    FormElements.Item(LCase(sFieldName))= FormElements.Item(LCase(sFieldName)) &amp; \", \" &amp; Byte2String(MidB(VarArrayBinRequest, nCurPos, nEndOfData-nCurPos))
    end if

    End If

    'Advance to next separator
    nDataBoundPos = FindToken(vDataSep, nCurPos)
    Loop
    StreamRequest.WriteText(VarArrayBinRequest)
    End Sub

    Private Function SkipToken(sToken, nStart)
    SkipToken = InstrB(nStart, VarArrayBinRequest, sToken)
    If SkipToken = 0 then
    Response.write \"Error in parsing uploaded binary request. The most likely cause for this error is the incorrect setup of AspMaxRequestEntityAllowed in IIS MetaBase. Please see instructions in the <A HREF='http://www.freeaspupload.net/freeaspupload/requirements.asp'>requirements page of freeaspupload.net</A>.<p>\"
    Response.End
    end if
    SkipToken = SkipToken + LenB(sToken)
    End Function

    Private Function FindToken(sToken, nStart)
    FindToken = InstrB(nStart, VarArrayBinRequest, sToken)
    End Function

    Private Function ExtractField(sToken, nStart)
    Dim nEnd
    nEnd = InstrB(nStart, VarArrayBinRequest, sToken)
    If nEnd = 0 then
    Response.write \"Error in parsing uploaded binary request.\"
    Response.End
    end if
    ExtractField = Byte2String(MidB(VarArrayBinRequest, nStart, nEnd-nStart))
    End Function

    'String to byte string conversion
    Private Function String2Byte(sString)
    Dim i
    For i = 1 to Len(sString)
    String2Byte = String2Byte &amp; ChrB(AscB(Mid(sString,i,1)))
    Next
    End Function

    'Byte string to string conversion
    Private Function Byte2String(bsString)
    Dim i
    dim b1, b2, b3, b4
    Byte2String =\"\"
    For i = 1 to LenB(bsString)
    if AscB(MidB(bsString,i,1)) < 128 then
    ' One byte
    Byte2String = Byte2String &amp; ChrW(AscB(MidB(bsString,i,1)))
    elseif AscB(MidB(bsString,i,1)) < 224 then
    ' Two bytes
    b1 = AscB(MidB(bsString,i,1))
    b2 = AscB(MidB(bsString,i+1,1))
    Byte2String = Byte2String &amp; ChrW((((b1 AND 28) / 4) * 256 + (b1 AND 3) * 64 + (b2 AND 63)))
    i = i + 1
    elseif AscB(MidB(bsString,i,1)) < 240 then
    ' Three bytes
    b1 = AscB(MidB(bsString,i,1))
    b2 = AscB(MidB(bsString,i+1,1))
    b3 = AscB(MidB(bsString,i+2,1))
    Byte2String = Byte2String &amp; ChrW(((b1 AND 15) * 16 + (b2 AND 60)) * 256 + (b2 AND 3) * 64 + (b3 AND 63))
    i = i + 2
    else
    ' Four bytes
    b1 = AscB(MidB(bsString,i,1))
    b2 = AscB(MidB(bsString,i+1,1))
    b3 = AscB(MidB(bsString,i+2,1))
    b4 = AscB(MidB(bsString,i+3,1))
    ' Don't know how to handle this, I believe Microsoft doesn't support these characters so I replace them with a \"^\"
    'Byte2String = Byte2String &amp; ChrW(((b1 AND 3) * 64 + (b2 AND 63)) &amp; \",\" &amp; (((b1 AND 28) / 4) * 256 + (b1 AND 3) * 64 + (b2 AND 63)))
    Byte2String = Byte2String &amp; \"^\"
    i = i + 3
    end if
    Next
    End Function
    End Class

    Class UploadedFile
    Public ContentType
    Public Start
    Public Length
    Public Path
    Private nameOfFile

    ' Need to remove characters that are valid in UNIX, but not in Windows
    Public Property Let FileName(fN)
    nameOfFile = fN
    nameOfFile = SubstNoReg(nameOfFile, \"\\", \"_\")
    nameOfFile = SubstNoReg(nameOfFile, \"/\", \"_\")
    nameOfFile = SubstNoReg(nameOfFile, \":\", \"_\")
    nameOfFile = SubstNoReg(nameOfFile, \"*\", \"_\")
    nameOfFile = SubstNoReg(nameOfFile, \"?\", \"_\")
    nameOfFile = SubstNoReg(nameOfFile, \"\"\"\", \"_\")
    nameOfFile = SubstNoReg(nameOfFile, \"<\", \"_\")
    nameOfFile = SubstNoReg(nameOfFile, \">\", \"_\")
    nameOfFile = SubstNoReg(nameOfFile, \"|\", \"_\")
    End Property

    Public Property Get FileName()
    FileName = nameOfFile
    End Property

    'Public Property Get FileN()ame
    End Class


    ' Does not depend on RegEx, which is not available on older VBScript
    ' Is not recursive, which means it will not run out of stack space
    Function SubstNoReg(initialStr, oldStr, newStr)
    Dim currentPos, oldStrPos, skip
    If IsNull(initialStr) Or Len(initialStr) = 0 Then
    SubstNoReg = \"\"
    ElseIf IsNull(oldStr) Or Len(oldStr) = 0 Then
    SubstNoReg = initialStr
    Else
    If IsNull(newStr) Then newStr = \"\"
    currentPos = 1
    oldStrPos = 0
    SubstNoReg = \"\"
    skip = Len(oldStr)
    Do While currentPos <= Len(initialStr)
    oldStrPos = InStr(currentPos, initialStr, oldStr)
    If oldStrPos = 0 Then
    SubstNoReg = SubstNoReg &amp; Mid(initialStr, currentPos, Len(initialStr) - currentPos + 1)
    currentPos = Len(initialStr) + 1
    Else
    SubstNoReg = SubstNoReg &amp; Mid(initialStr, currentPos, oldStrPos - currentPos) &amp; newStr
    currentPos = oldStrPos + skip
    End If
    Loop
    End If
    End Function

    Function GetFileName(strSaveToPath, FileName)
    'This function is used when saving a file to check there is not already a file with the same name so that you don't overwrite it.
    'It adds numbers to the filename e.g. file.gif becomes file1.gif becomes file2.gif and so on.
    'It keeps going until it returns a filename that does not exist.
    'You could just create a filename from the ID field but that means writing the record - and it still might exist!
    'N.B. Requires strSaveToPath variable to be available - and containing the path to save to
    Dim Counter
    Dim Flag
    Dim strTempFileName
    Dim FileExt
    Dim NewFullPath
    dim objFSO, p
    Set objFSO = CreateObject(\"Scripting.FileSystemObject\")
    Counter = 0
    p = instrrev(FileName, \".\")
    FileExt = mid(FileName, p+1)
    strTempFileName = left(FileName, p-1)
    NewFullPath = strSaveToPath &amp; \"\\" &amp; FileName
    Flag = False

    Do Until Flag = True
    If objFSO.FileExists(NewFullPath) = False Then
    Flag = True
    GetFileName = NewFullPath 'Mid(NewFullPath, InstrRev(NewFullPath, \"\\") + 1)
    Else
    Counter = Counter + 1
    NewFullPath = strSaveToPath &amp; \"\\" &amp; strTempFileName &amp; Counter &amp; \".\" &amp; FileExt
    End If
    Loop
    End Function

    %>
  • Thanks tony... forgive me if this is a stupid question or i'm missing the point. I thought the Uploadify plugin handled the upload. What I would like to see is the asp code that Uploadify calls from the script call (uploader.asp) in your code example a few post ago.

    'script' : 'http://localhost/xxxx/uploader.asp',

    The examples are all php which i cant translate as its not my strong point.

    Thanks
  • That IS the asp code, uploader.asp. Uploadify handles the client sidem the asp resides on the server.
  • Well, I think I'm kinda thinking along the same lines as mook here.

    Traditionally when uploading files with classic ASP there are two things at work:
    [list]ASP pages that present the user with a form to select a single file, as well as to then do stuff on the back-end like process the uploaded image and then maybe update something in a database
    A COM component that actually handles the uploading[/list:u]

    It seems like the uploader.cls file in your example is maybe doing the work that a COM component would normally do, is that right?

    And if so, what is Uploadify actually doing in this context? Is it ONLY allowing for multiple files to be uploaded, rather than a single one?

    My understanding is that Uploadify would take the place of the COM component, AND do so in a way that would allow users to upload multiple files at once. Given that, I would guess that most of our back-end ASP code would remain the same, but instead of accessing the COM component to get a single file's info, we'd be accessing Uploadify to do the same for multiple files.

    Is this an incorrect assumption? Do we need Uploadify + our ASP form / back-end stuff + COM component still?

    And how do we get the list of files from Uploadify on the back-end so that we can process them iteratively?
  • So NOBODY knows the answer to this question?
  • I have the code! Sorry I havent checked the forums in a while.

    I used FreeASPUpload
    http://www.freeaspupload.net

    It wasnt that hard to make it work at all, and it is really fast even for multi file uploads.

    My code has a whole bunch of extra functions that logs info to a database and also pulls out metadata out of the uploaded files...

    I havent ported my code to work with Upload 2.X yet however so I don't know if you all want me to upload an example file.

    Just say so and I will!
  • Hi Triagency
    I'm definitively waiting for your sample code :)
    I've been required to implement such a feature with this great plugin

    Regards
  • whitearrow38 said:
    Hi Triagency
    I'm definitively waiting for your sample code :)
    I've been required to implement such a feature with this great plugin

    Regards


    Hey there whitearrow38 its your lucky day... havent logged on to here in months and I just saw this... and im on day one of a 3 day code overhaul so its a great time to get that sample together. Please note however that it is NOT Uploadify 2.0... I might try to get that working, but unless there is a speed increase I dont want to have to rewire my JS to match the new API.

    I have done extensive testing with it and had it in production for about 25 users that use it in my CMS. Works great, although I am having some timeout issues that are due to high server usage with ASP in general, and with files over 70mb or so... I have used it to get files as large as 90mb uploaded. However I have had some suggestions that FreeASPUpload is not the fastest solution, and I need something a little more industrial strength for the future anyway.

    I have decided that I am porting everything to PHP soon, so I don't know if I will be upgrading the ASP one, but I will be happy to share my code... Give me til tomorrow and I will make a zip file.
  • Guys, im developing this in classic asp and need some help from now.
    I'm having bad times on my backend script, im still dont understand how the request file works, im making the request command (querystring and form, as i set GET or POST).
    I let the 'fileDataName' as default, set the response method as GET and in my asp script, i make the 'request.querystring("Filedata")'.

    The value returned is empty, so, from the experts in uploadfy, how can i make it work?


    ps.: sorry about the bad english.
  • no one know how to do it in classic asp? :'(
  • You might find it a little easier to debug your upload script if you throw together a test page which does not use Uploadify. For example...












    Then you will get the errors returned in your browser rather than have to scan through the web logs to find out what's going on.

    Once you have it working correctly, swap back to the Uploadify page and it should work.
  • Hi,

    I too stumbled across the site a while ago in an attempt to find a classic ASP version. Like others decided that needs must and built my own from snippets from here and there which I offer to you as a small token of gratitude for a perfectly great little tool.

    I've tried to be as complete as I can with the files I uploaded, drop me an IM from here if you have any problems. The only ones I have are when I'm trying to upload numerous large files, the system doesn't seem to like this no matter how much server.scripttimeout I add....ho-hum.

    Good luck!
  • Hello

    I am using Classic ASP (ASP 3.0) with Uploadify, but there is a problem. My code can only upload one file at a time. After the upload, an HTTP Error occurs. Can anybody help me ?

    The code for uploading in ASP with Uploadify is installed for tests in this link:

    www.advancedsystems.com.br/upload/test/index.asp

    You can download the archives in the address:

    www.advancedsystems.com.br/upload/upload.zip

    You can contact me at the e-mail address: [email protected]

    Help me, share your knowledge, we can turn this code better and use it in our projects. Two minds think better than only one.
  • Hello to everyone. I'm new to this forum. I know I am one year late (!), but I had to implement Uploadify in classic Asp, and I want to share this simple script with you, since it seems to work fine. Unfortunately, I could not use FreeASPUpload, but I had to use the Server Object "ActiveFile" by Infomentum, and I do not know if it is still mantained or not.
    Naleem

    This is the script:
    <%
    ' If it is an upload call
    If LCase(Left(Request.ServerVariables("HTTP_Content_Type"),19)) = "multipart/form-data" Then
    ' Perform upload
    Set Post = Server.CreateObject("ActiveFile.Post")
    Post.Upload Server.MapPath("/temp") & "\" , 1
    ' For all form fields
    For Each FormInput In Post.FormInputs
    ' If it is a file field
    If FormInput.ContentType <> "" Then
    ' Return Filename
    Response.Write FormInput.File.FileName
    End If
    Next
    ' If it is a direct call
    Else
    ' Return some message
    Response.Write "Webservice up and running."
    End If
    %>
  • <%
    ' If it is an upload call
    If LCase(Left(Request.ServerVariables("HTTP_Content_Type"),19)) = "multipart/form-data" Then
    ' Perform upload
    Set Post = Server.CreateObject("ActiveFile.Post")
    Post.Upload Server.MapPath("/temp") & "\" , 1
    ' For all form fields
    For Each FormInput In Post.FormInputs
    ' If it is a file field
    If FormInput.ContentType <> "" Then
    ' Return Filename
    Response.Write FormInput.File.FileName
    End If
    Next
    ' If it is a direct call
    Else
    ' Return some message
    Response.Write "Webservice up and running."
    End If
    %>
  • NE1 tell me how to post the file names to a database?