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.
checkScript and ASP.NET
  • Hello:

    I have looked around but have not seen a definitive method to solve my problem. When delivered, Uploadfy has Check.php fie for use with the checkScript option. I need to be able to do what this file has to offer, i.e., check to see if my file to be uploaded is already on the server. Is there an ASP.NET (VB or C#) equivalent of the check php file?

    Thanks.
  • So far no one has replied, but I have been looking into this myself. So far, I have come up with the following Check.ashx code:
    <%@ WebHandler Language=\"VB\" Class=\"Check\" %>

    Imports System
    Imports System.Web
    Imports System.IO
    Imports System.Runtime.Serialization.Json
    Imports System.Collections.Specialized
    Imports System.Collections.Generic

    Public Class Check : Implements IHttpHandler

    Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
    'context.Response.ContentType = \"text/plain\"
    'context.Response.Write(\"Hello World\")

    Dim fileArray As New Dictionary(Of String, String)

    For x As Integer = 0 To context.Request.Form.Count - 1
    If context.Request.Form.Keys(x) <> \"folder\" Then
    If File.Exists(context.Server.MapPath(context.Request.Form(\"folder\") &amp; \"/\" &amp; context.Request.Form.Item(x))) Then
    fileArray.Add(context.Request.Form.Keys(x), context.Request.Form.Item(x))
    End If
    End If
    Next

    Dim jSer As DataContractJsonSerializer = New DataContractJsonSerializer(fileArray.GetType())
    Dim ms As MemoryStream = New MemoryStream()
    jSer.WriteObject(ms, fileArray)
    Dim json As String = Encoding.Default.GetString(ms.ToArray())

    context.Response.Write(json)

    End Sub

    Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
    Get
    Return False
    End Get
    End Property

    End Class


    I set checkScript to Check.ashx and the handler works in that the handler is called when I click the browse button, and it finds the file(s) that already exist and puts their keys and names into the fileArray object. The JSON encoding appears to pass back something that OnCheck likes, because I do get a dialog prompt about replacing the existing file. However, the dialog message says: "Do you want to replace the file [object Object]?" which makes me think that the JSON encoding didn't go as Uploadify would have expected it. When looking at the debugger, the json variable above contains the following text:

    "[{"Key":"BYEHVV","Value":"CHM_120804_WkStn_PedSec 001.JPG"},{"Key":"GAEWOY","Value":"CHM_120804_WkStn_PedSec 002.JPG"}]"

    Is this what Uploadify is expecting? It is JSON encoded, but I'm not sure if it is totally correct.

    Thanks,

    Scott
  • This is pretty old now, but I ran into the same problem. I found a solution after playing around for a while. This works in .Net 3.5 and greater (I don't think it works prior to that).

    Imports System.Web.Script.Serialization

    and instead of this:



    Dim jSer As DataContractJsonSerializer = New DataContractJsonSerializer(fileArray.GetType())
    Dim ms As MemoryStream = New MemoryStream()
    jSer.WriteObject(ms, fileArray)
    Dim json As String = Encoding.Default.GetString(ms.ToArray())

    Use this:

    Dim jSer As JavaScriptSerializer = New JavaScriptSerializer
    context.Response.ContentType = "application/json"
    context.Response.Write(jSer.Serialize(fileArray))

    There still may be other ways to complete this, but it works for me.
  • that file isn't working for me.

    $("#<%=FileUpload1.ClientID%>").uploadify({
    'uploader': 'scripts/uploadify.swf',
    'script': 'Upload.ashx',
    'checkscript' : 'Handler2.ashx',
    'cancelImg': 'images/cancel.png',
    'folder': 'uploads',
    'multi': true,
    'auto': true
    });

    Handler2.ashx

    Imports System
    Imports System.Web
    Imports System.IO
    Imports System.Runtime.Serialization.Json
    Imports System.Collections.Specialized
    Imports System.Collections.Generic
    Imports System.Web.Script.Serialization

    Public Class Check : Implements IHttpHandler

    Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
    'context.Response.ContentType = "text/plain"
    'context.Response.Write("Hello World")

    Dim fileArray As New Dictionary(Of String, String)

    For x As Integer = 0 To context.Request.Form.Count - 1
    If context.Request.Form.Keys(x) <> "folder" Then
    If File.Exists(context.Server.MapPath(context.Request.Form("folder") & "/" & context.Request.Form.Item(x))) Then
    fileArray.Add(context.Request.Form.Keys(x), context.Request.Form.Item(x))
    End If
    End If
    Next

    Dim jSer As JavaScriptSerializer = New JavaScriptSerializer
    context.Response.ContentType = "application/json"
    context.Response.Write(jSer.Serialize(fileArray))

    End Sub

    Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable
    Get
    Return False
    End Get
    End Property

    End Class



    What am I missing?