Error 404 when uploading on Mac

Hi,
First of all - many thanks for SWFUpload, it's a great thing!

Unfortunatelly, I have a problem when uploading files from Mac OS X (on various browsers such as Safari, Firefox, Opera). Here is a description of it:

I wrote a project in Symfony framework and used SWFUpload do send files to the server. Everything worked OK when it was installed on my own Apache at home (Linux machine). The url to my project was http://localhost and to upload_url for SWFUpload was http://localhost/file/receive (the 'receive' action in the 'file' module). Worked very good!

The problem started when I installed my project on the production server (let's say it's myhost.net with /home/myhost/www web folder) and registered a subdomain for this project (swfupload.myhost.net which points on the /home/myhost/www/swfupload/web directory). It stopped working with Macs (I get 'An error occurred in the upload. Try again later.', and that's it - no more info).
I turned on the Debug mode and got this:


----- SWFUPLOAD SETTINGS ----
ID: undefined
upload_url: http://swfupload.myhost.net/file/receive
file_post_name: theFile
post_params: {
}

file_types: *.*
file_types_description: All Files
file_size_limit: 100000240
file_upload_limit: 0
file_queue_limit: 1

flash_url: /js/swfupload_f9.swf
flash_width: 1px
flash_height: 1px
flash_color: #FFFFFF
debug_enabled: true
swfupload_element_id: flashUI
degraded_element_id: degradedUI
user_swfUploadLoaded_handler:

function myShowUI() {
document.getElementById("uploadForm").onsubmit = doSubmit;
SWFUpload.swfUploadLoaded.apply(this);
validateForm();
}
----- SWFUPLOAD SETTINGS END ----

SWF DEBUG: SWFUpload Init Complete
SWF DEBUG:
SWF DEBUG: ----- SWF DEBUG OUTPUT ----
SWF DEBUG: Build Number: SWFUPLOAD 2.0.2 FP8 2008-01-07 0001
SWF DEBUG: movieName: SWFUpload_0
SWF DEBUG: Upload URL: http://swfupload.myhost.net/file/receive
SWF DEBUG: File Types String: *.*
SWF DEBUG: Parsed File Types:
SWF DEBUG: File Types Description: All Files (*.*)
SWF DEBUG: File Size Limit: 102400245760 bytes
SWF DEBUG: File Upload Limit: 0
SWF DEBUG: File Queue Limit: 1
SWF DEBUG: Post Params:
SWF DEBUG: ----- END SWF DEBUG OUTPUT ----
SWF DEBUG:
Flash called back and is ready.

SWF DEBUG: Event: fileDialogStart : Browsing files. Single Select. Allowed file types: *.*
SWF DEBUG: Select Handler: Files Selected from Dialog. Processing file list
SWF DEBUG: Type: number Value:1
SWF DEBUG: Event: fileQueued : File ID: SWFUpload_0_0
SWF DEBUG: Event: fileDialogComplete : Finished adding files
SWF DEBUG: StartUpload(): Starting Upload: First file in queue
SWF DEBUG: StartFile: First file in queue
SWF DEBUG: Event: uploadStart : File ID: SWFUpload_0_0
SWF DEBUG: startFile(): File Reference found. File accepted by startUpload event. Starting upload to http://swfupload.myhost.net/file/receive for File ID: SWFUpload_0_0
SWF DEBUG: Event: uploadProgress: File ID: SWFUpload_0_0. Bytes: 65536. Total: 159231

[a few lines with a progress..]

SWF DEBUG: Event: uploadProgress: File ID: SWFUpload_0_0. Bytes: 159231. Total: 159231
SWF DEBUG: Event: uploadError: HTTP ERROR : File ID: SWFUpload_0_0. HTTP Status: 404.
SWF DEBUG: Event: uploadComplete : Upload cycle complete.

I looked into the Apache's error logs and saw that SWFUpload requests the /home/myhost/www/file/receive directory which does not exist. It looks like SWFUpload made a request without the full patch to the project and Apache can't find that path.

It's quite odd, because I use the absolute path for SWFupload in "upload_url".
On windows everything works OK, the Apache Access log shows:


POST /file/receive?
HTTP/1.1 Status: 200, 9 B
Shockwave Flash

...but when I use Mac, I get:

POST /file/receive?
HTTP/1.1 Status: 404, 2157 B
Adobe Flash Player 9

... in access log, and in error log:

[error] File does not exist: /home/myhost/www/file

Is it a Flash plugin issue? Do you have any ide how I can solve this problem?

Thanks.

Hi,I think, I found the

Hi,
I think, I found the solution to my problem Smiling
I've read dr feelgood's comment on this page and found out that this is the reason why my upload doesn't work. The main reason is I am using a subdomain.
I can access my project via http://swfupload.myhost.net and also via http://myhost.net/swfupload/web. The second address seems to work OK, and upload is successful, however it's not very nice Sad
Also, I had to place the crossdomain.xml file at the DocumentRoot of my server. I took the source code to this file from here.

Now, is there any way to use subdomain in the address, and not the top-level domain?

If not, I'll use the top-level domain, but it would be really nice to use the subdomain too.

gyphie's picture

Domains

I'm not sure why you are having the specific issue that you are having or why it only occurs on OS X. I have some vague ideas but nothing solid to go on.

My only suspicion is that the Flash Player does not post the correct "host: " header on OS X. If you are using virtual directories (or Host Headers) on your server then I could see what you described happening.

--------------
You might be able to resolve your issue (in part) by keeping your page on swfupload.myhost.net but setting your Flash URL and Upload URL to the myhost.net/swfupload/web formatted URLs. Then from the user's point of view you are always on swfupload.myhost.net and SWFUpload should continue to work correctly in the background using the other URLs.

Doing that may also eliminate the need for the crossdomain.xml file (maybe, I haven't done extensive cross domain testing).

In order to host the HTML page on one domain and the .SWF file on another domain you'll need the updated swfupload.js file from the SVN server (note, this an in development file that may not be in a working state at any given time).