5

Using SWFUpload v2.2, Firefox 3, IE 8, Flash 10 In my ASP.NET application all uploads are being processed by upload.aspx (I have the correct upload_url set in the settings object). In IE 8 the uploads hit the upload.aspx page and are processed, but in Firefox they do not. Any suggestions?

Most of the code for the page that the user visits to upload a file is shown here (note: master pages are being used):

<script type="text/javascript" src="../swfupload/swfupload.js"></script>

<script type="text/javascript" src="../js/handlers.js"></script>

<script type="text/javascript">
    var swfu;
    window.onload = function() {
        swfu = new SWFUpload({
            // Backend Settings
            upload_url: "../upload.aspx",
            post_params: {
                "ASPSESSID": "<%=Session.SessionID %>"
            },

            // File Upload Settings
            file_size_limit: "10 MB",
            file_types: "*.*",
            file_types_description: "All Files",
            file_upload_limit: 1,
            file_queue_limit: 1,
            //assume_success_timeout: 60,

            // Event Handler Settings - these functions as defined in Handlers.js
            //  The handlers are not part of SWFUpload but are part of my website and control how
            //  my website reacts to the SWFUpload events.
            file_queue_error_handler: fileQueueError,
            file_dialog_complete_handler: fileDialogComplete,
            upload_progress_handler: uploadProgress,
            upload_error_handler: uploadError,
            upload_success_handler: uploadSuccess,
            upload_complete_handler: uploadComplete,

            // Button settings
            button_image_url: "../Images/XPButtonNoText_160x22.png",
            button_placeholder_id: "spanButtonPlaceholder",
            button_width: 160,
            button_height: 22,
            button_text: '<span class="button">Upload File<span class="buttonSmall">(10 MB Max)</span></span>',
            button_text_style: '.button { font-family: Helvetica, Arial, sans-serif; font-size: 14pt; } .buttonSmall { font-size: 10pt; }',
            button_text_top_padding: 1,
            button_text_left_padding: 5,

            // Flash Settings
            flash_url: "../swfupload/swfupload.swf", // Relative to this file

            custom_settings: {
                upload_target: "divFileProgressContainer"
            },

            // Debug Settings
            debug: false
        });
    }
</script>
Xolamee
  • 81
  • 1
  • 2
  • 6

7 Answers7

2

I know, its an old post, but maybe it will help to solve the problem for some people, because i had the same problem today.

I solved this problem not with using the post array, because i don't know how, and where to debug this script, but with generating a querystring

<script type="text/javascript">
    var swfu;
    window.onload = function() {
        swfu = new SWFUpload({
            // Backend Settings
            upload_url: "../upload.aspx",
            post_params: {
                SessionID: "<%=Session.SessionID %>",
                OtherID: "<%=OtherID %>"
            },

            //And here comes the highlight

            use_query_string : true,

            //code ...

After this you will get a querystring like this: ?SessionID=(id)&OtherID=(otherid)

This works with guarantee under every browser.

therufa
  • 2,050
  • 2
  • 25
  • 39
  • for what do you use the OtherID? – Thariama Apr 11 '11 at 12:13
  • it does no matter. I just added it as example. Thanks for noticing it. – therufa Apr 13 '11 at 11:24
  • so the important thing here is the use of use_query_string? I still do not understand how this solves the problem. Could you please explain? – Thariama Apr 13 '11 at 11:53
  • 1
    swf upload tends to send the post_params array through POST to the server. With use_query_string you can force swfupload to send the params through GET. v2.2 couldn't post the params in ie7-8. This fixed it, in.. some way – therufa Apr 13 '11 at 14:43
  • thx for your explanation. you mean the flash component of sfwupload will use a POST request? – Thariama Apr 13 '11 at 16:39
2

Try in another browser too, such as Safari or Chrome.

If it works only in IE, it's probably the Flash Cookie Bug the other answers mention.

If it works in everything except Firefox, it could be that there's no css defined for the progress bar. I don't know why this causes a problem, but I found that it did. As soon as I put the sample styles into my css file, it started working in Firefox.

The css I used is as follows:

DIV.ProgressBar { width: 100px; padding: 0; border: 1px solid black; margin-right: 1em; height:.75em; margin-left:1em; display:-moz-inline-stack; display:inline-block; zoom:1; *display:inline; }
DIV.ProgressBar DIV { background-color: Green; font-size: 1pt; height:100%; float:left; }
SPAN.asyncUploader OBJECT { position: relative; top: 5px; left: 10px; }
teedyay
  • 23,293
  • 19
  • 66
  • 73
  • Thanks for the great answer. I had a bug where it would upload fine in IE8/9, but in Firefox it would fail saying (in ASP.NET) Request.Files collection was empty. Adding the CSS code made it upload perfectly in Firefox. – Matt Murrell Feb 27 '12 at 18:10
1

Just wanted to confirm that the same problem was just fixed by adding post_params variable to the SWFUpload init.

post_params : {
    PHPSESSID : '<?=session_id()?>'
},
Smi
  • 13,850
  • 9
  • 56
  • 64
Didzis
  • 308
  • 3
  • 15
1

Use an HTTP trace/debugging proxy to see if anything is actually being sent to the server at all and what response is being received, if any. Charles is my favorite and works great with Flash (and everything else HTTP). WireShark and Fiddler are other options.

Charles http://www.xk72.com/charles/

WireShark http://www.wireshark.org/

Fiddler http://www.fiddler2.com/fiddler2/

Samuel Neff
  • 73,278
  • 17
  • 138
  • 182
  • Charles was an excellent suggestion! Using Charles I was able to confirm that nothing is being sent to the server (all requests are GETs). Now I'm still stuck trying to figure out why! Also, no traffic from IE is showing up in Charles, so I'm having a difficult time figuring out what a successful POST looks like. Charles is supposed to automatically configure IE, and it appears that it is, but no traffic shows up. – Xolamee Feb 11 '10 at 22:37
  • IE and Firefox proxying work differently. From what I remember, you have to specifically turn on Windows proxy for IE, and if you're developing locally you need to turn off a setting in IE somewhere to "bypass proxy for localhost". – Samuel Neff Feb 11 '10 at 22:46
  • I just realized that this is a known problem with IE 7, and visiting my website via "http://computername" instead of "http://localhost" fixes the behavior. Running scans of both IE and Firefox revealed that they both go through the exact same sequence of GETs but in Firefox there is no post to upload.aspx, and in IE there is. Thanks for continuing to help me with this Sam. Are there any clues I could look for that would suggest why Firefox does not POST? – Xolamee Feb 11 '10 at 23:06
  • The only other suggestion I can say is make sure you have the debug Flash player installed. If you have the release player it won't display error messages but the debug one will. I'm pretty sure you can download the debug player by itself but if not it does comes with Adobe products like Flex Builder and Flash CS4 (which have free trials). – Samuel Neff Feb 12 '10 at 03:41
1

http://demo.swfupload.org/Documentation/

Cookie issue

On Windows the Non-IE Flash Player plugin (FireFox, Opera, Safari, etc) will send the IE cookies regardless of the browser used. This breaks authentication and sessions for many server-side scripting technologies.

Developers should manually pass Session and Authentication cookie information and manually restore Sessions on the Server Side if they wish to use Sessions

The SWFUpload package contains work-around sample code for PHP and ASP.Net

===== Implementing some once off authentication ticket from there will make things work fine

You can also make it conditional that this authentication is only applied when users are using the upload

However, some test to ensure that the authentication cookie does not get around the other part of the site maybe important depending on how you issue the cookie for this action.

NiceCall
  • 21
  • 5
0

I found the answer ... finally. I was struggling with this for a very long time. Can't believe this is the answer. The reason is SUBST.

I have a computer with SSD drive and since it is 256GB only I decided not to partition it. However I like split between C and D partitions and I emulated it on my SSD drive via subst command. If I pickup the file from the drive which is created with subst command, the swf upload doesn't work. I almost can't believe that, but it is a fact I finally discovered today being unable to upload files on my development computer only.

norbi771
  • 814
  • 2
  • 12
  • 29
0

It sounds like you could be running into this Flash bug. Nort's solution is the way most people have been working around it. Depending on your language/framework however, you may need to add some additional server-side code to take the session variable from the url and force it to be used as the current session.

You can try the solution in this StackOverflow question, or try googling something like 'flash upload cookie'.

Community
  • 1
  • 1
Nick Knowlson
  • 7,185
  • 6
  • 47
  • 63