views:

2029

answers:

2

hey everyone,

I have a pretty straight forward uploadified page that allows users to upload files, it works beautifully when I run it on my local machine accessing it through http://localhost/project/etc

the problem is when i try to access the same stuff from outside of localhost, even if trying to get to it through my machinename (http://mycomp1/project/etc), the pages load/etc and everything appears to work, but nothing is being transferred, I have firebug open and normally it will show any ajax requests that are going through but I'm getting nothing.

Any ideas?

my uploadify code:

$('#uploadify').uploadify({
    'scriptAccess': 'always',
    'uploader': '../../scripts/uploadify.swf', //flash source for handling the uploads and size checking
    'cancelImg': '../../content/images/cancel.png', //cool cancel button
    'script': '../../' + $('#Controller').val() + '/FileSave/' + $('#OrderID').val(), //sends files to the controller with apropriate data
    'folder': 'Uploads', //sets the upload directory, not sure if this matters as the files are sent to the controller
    'multi': true, //allows multiple uploads
    'auto': false, //uploads dont start automatically
    'queueSizeLimit': 5, //5 files can be in the queue at a time
    'queueID': 'fileQueue', //div to contain the queue of files
    'displayData': 'speed', //shows the transfer speed
    'fileExt': '*.pdf', //limits to pdfs
    'fileDesc': 'PDF', //shows a description in the browse window of filetypes
    'sizeLimit': '5242880', //5mb limit
    'scriptData': { 'CategoryID': $('#fileCategory').val() }, //passes the selected value of the category drop down
    onComplete: function(event, queueID, fileObj, response, data) {//once a transfer completes fires an ajax function to pull in the files for the order 
        if (response == "Upload Successful") {//if response is successfull, updates div displaying files with new files
            GetFiles($('#Controller').val());
        }
    }
});

UPDATE: It appears to be something with the scriptAccess setting but even when set to always, as said on the uploadify website it still is not firing any backend scripts or my onComplete function

UPDATE2: on further inspection it seems like my script path was not correct when in a non localhost setting, but now with the script in the right location the response im getting in my onComplete function is equal to the html output of my login page. any ideas?

UPDATE3: Looks like my script path is ok, just for some reason when not on localhost I get a response of my login page instead of upload successful or upload failed as i should from my backend code

+3  A: 

For the login page issue, it sounds like flash is not respecting your sessions.

Assuming you are using PHP, make sure you pass your PHP sessionid in the post from your Flash object. For example, with SWF Upload this is done by passing it into the post_params settings. Then, make sure you do something like this before session start:

if( isset( $_POST['session_id'] ) && !empty( $_POST['session_id'] ) )
    session_id( $_POST['session_id'] )

session_start();

EDIT: I just noticed the ASP tag on this. I found this article regarding flash sessions in ASP. Hopefully that will help.

http://swfupload.org/forum/generaldiscussion/98

EDIT: Some more uploadify + ASP specific information.

http://www.uploadify.com/forum/viewtopic.php?f=7&t=1178

This looks really promising:::

Using Flash with ASP.NET MVC and Authentication

Kevin Peno
I had the same issue with SWFUpload. Starting the session manually did the trick for me.
Pekka
why would this work on localhost and not on a production server or even on my same machine just accessed through the machine name? i am looking through your linked article just curious if you have any ideas why
Jimmy
i tried implementing the code from the blog post you linked but im still not getting it to work with uploadify, any other suggestions?
Jimmy
but it does seem like this is the problem, my uploadify is working in IE, and now that I have the cookie in IE its working in firefox, wonder why this didn't happen on localhost though?
Jimmy
Added a new link directly related to ASP.Net MVC + Uploadify + Flash security/session problem.
Kevin Peno
thanks for the link, still having the same problem, not even able to hit actionfilters at all
Jimmy
+1  A: 

Had ~same problem and solution was quite trivial - add crossdomain.xml to the visible root folder of your web server(s) Uploadify is accessing. It should contain following info

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"&gt;
<cross-domain-policy>
<allow-access-from domain="yourdomain"/>
</cross-domain-policy>

Furthermore I advice you to read this manual to better understand whole point of this file.

Please try this method to see if this was a root of the problem.

mth
Now that you've mentioned this, it makes me wonder if his file linking has some hardcoded values pointing to "other domains" when it shouldn't.
Kevin Peno
it doesn't, also this is because of the flash IE cookie bug, not because of a domain access problem
Jimmy