We help IT Professionals succeed at work.
Get Started

Do you have to write custom php with uploadify?

Last Modified: 2016-03-10
I'm using uploadify and on my local machine the uploading works fine, but when I push my application out to our development server, the files don't get uploaded at all even though I get the message saying that the upload has completed / was successful. It also restarts my application and kicks me out to my login page. In my research I see examples of people who have had a similar problem, but in those cases they are using custom .php code which I was not under the impression that I needed to do that especially since it works fine on my local machine with out it. Thought? Links?

my IHttpHandler class
public class Upload : IHttpHandler, IReadOnlySessionState

        /// <summary>**********************************
        /// ProcessRequest                            *
        /// </summary>**********************************
        public void ProcessRequest(HttpContext context)
            string UploadPath = "InspectionImagesNew\\";
            string strPathToSave = "BEFORE PATH IS APPLIED";

                HttpPostedFile fileToUpload = context.Request.Files["Filedata"];

                //WORKS LOCALLY ON MY MACHINE***************************************************************************************************************
                strPathToSave = HttpContext.Current.Server.MapPath("InspectionImagesNew//") + "TEMP_" + context.Session["VIN"].ToString() + "/" + fileToUpload.FileName;

                //System.IO.File.WriteAllText(@"C:\test.txt", strPathToSave);
                    context.Session["ERROR_FROM_ASHX_CODE"] = strPathToSave;
                catch (Exception ex)
            catch (Exception ex)
                context.Response.ContentType = "text/plain";
                context.Session["ERROR_FROM_ASHX_CODE"] = ex.Message.ToString();

        public bool IsReusable
                return false;

Open in new window

my jQuery
        $(document).ready(function () {
            $("#<%=FileUpload1.ClientID %>").uploadify(
                'swf': 'Scripts/uploadify.swf',
                'uploader': 'Upload.ashx',
                'auto': true,
                'multi': true,
                'buttonText': 'Select File(s)',
                //'onQueueComplete': function (queueData) {
                //    alert(queueData.uploadsSuccessful + ' files were successfully uploaded.');
                'onQueueComplete': function (event, queueID, fileObj, response, data) {
                        type: "POST",
                        url: "StockPhotos.aspx/CopyAndRename",
                        data: "{}",
                        contentType: "application/json; charset=utf-8",
                        dataType: "json"
                    //alert('This alert ensures onComplete is being called correctly');
                'onUploadError': function (xhr, err) {
                    alert('responseText:' + xhr.responseText);

Open in new window

Watch Question
Most Valuable Expert 2011
Author of the Year 2014
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE