Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
898
Can't get igUpload working
posted

Hi, I'm working on a cshtml Project, using Jquery and JavaScript.

I can't get igUpload working. Seams that everything works fine on client side. But I never reach the ashx file.

 

This is my Setup

 

web.config for IIS7

<modules runAllManagedModulesForAllRequests="true">       <add name="IGUploadModule" type="Infragistics.Web.Mvc.UploadModule"                                  preCondition="managedHandler" />     </modules>

and handler

 

<add name="IGUploadStatusHandler" path="../webservice/fcus.ashx" verb="*"                type="Infragistics.Web.Mvc.UploadStatusHandler" preCondition="integratedMode" />

 

Client

 

$(function () {

             $("#igUpload").igUpload({

                 mode: 'single',

                 autostartupload: true,

                 allowedExtensions: ["gif", "jpg", "png"],

                  progressUrl: currentHost + "/Webservice/fcus.ashx",

                 controlId: "serverID1",

                 onError: function (e, args) {

                     alert(args.errorMessage);

                 },

                 fileSelecting:function (e, args) {

                                         if (imageCounter >= 10) {

                         alert(findEntry("maxFile", "Step"));

                         return false;

                     }

                 },

                 fileUploaded: function (e, args) {

                    loadPictureList();

                 }

             });

         });

 

 

This is my ashx

 

<%@ WebHandler Language="C#" Class="fcus" %>

using System;

using System.Web;

using System.IO;

public class receiver : IHttpHandler {

public void ProcessRequest (HttpContext context) {

string filename = context.Request.QueryString["filename"].ToString();

using (FileStream fs = File.Create(context.Server.MapPath("~/UserImages/" + filename)))

        {

            SaveFile(context.Request.InputStream, fs);

        }

    }

 

private void SaveFile(Stream stream, FileStream fs)

    {

byte[] buffer = new byte[4096];

int bytesRead;

while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) != 0)

        {

            fs.Write(buffer, 0, bytesRead);

        }

    }

public bool IsReusable {

get {

return false;

        }

    }

}

Parents
No Data
Reply
  • 898
    Verified Answer
    Offline posted

    Hi,

    after checking my configuration I found some mistakes. I solved them by reading som other Posts. Now eyerything works fine.

     

    Regards Manfred

Children
No Data