0

I am totally stumped on this...Using the asyncUpload and swfUpload JS plugins to have users upload a photo. After upload, the photo is displayed in a little area. Works perfect on any Windows browser, but no go on any Mac browser. So weird. I've narrowed it down to this piece:

            // Called when upload completed successfully (puts success details into hidden fields)
            upload_success_handler: function (file, response) {
                $("input[name$=_filename]", container).val(file.name);
                $("input[name$=_guid]", container).val(response);
                $("span[id$=_completedMessage]", container).html("<img class='uploader' src='/public/assets/logos/{0}{1}' /><br />"
                            .replace("{0}", response)
                            .replace("{1}", file.type)
                        );
            },

Here's what Firebug is saying is generated in a Mac browser (FF 3.6.13 in particular):

<span id="photo_completedMessage" style="display: inline;">
<img class="uploader" width="0" height="0" src="/public/logos/66764b72-ad65-44b3-8c08-e74c24ee1356JPEG">
<br>
</span>

So the GUID's being generated, and it's sort of finding the file type? But not placing it as an extension or something? If I type it in manually in the Bug, it shows up fine, so it's finding the image on the server. I'm lost. Help appreciated. Again, this is ONLY on ANY Mac browser. IE, Chrome, FF, Safari on Windows all work fine.

EDIT - Here's the Windows Firebug code:

<span id="photo_completedMessage" style="display: inline;">
<img class="uploader" width="203" height="285" src="/public/logos/66764b72-ad65-44b3-8c08-e74c24ee1356.jpg">
<br>
</span>
collin
  • 240
  • 1
  • 3
  • 12

1 Answers1

0

As showed up in documentation:

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

File Object
The file object is passed to several event handlers.
It contains information about the file.
Some operating systems do not fill in all the values
(this is especially true for the createdate and modificationdate values).

{
id : string,            // SWFUpload file id, used for starting or cancelling and upload
index : number,         // The index of this file for use in getFile(i)
name : string,          // The file name. The path is not included.
size : number,          // The file size in bytes
type : string,          // The file type as reported by the client operating system
creationdate : Date,        // The date the file was created
modificationdate : Date,    // The date the file was last modified
filestatus : number,        // The file's current status. Use SWFUpload.FILE_STATUS to interpret the value. 
}

The 'type' variable is implemented by operating system/browser.

Maybe you should parse "file.name" and search for its extension.

How can I get file extensions with JavaScript?

Community
  • 1
  • 1
Marek Sebera
  • 39,650
  • 37
  • 158
  • 244
  • Gotcha - I feel like this is the right path...But the functionality writes the file name correctly to the database (according to our developer), so the file displays fine on the output. Here's the step process, fyi: 1. Upload picture 2. Fill in info 3. PDF is output with uploaded picture up top. If the file is getting to the DB correctly, do you still have to force the Mac file type? – collin Feb 28 '11 at 17:01
  • If you are making output from DB and file is written in DB correctly, you don't have to still parse the extension. in other cases you should do it. – Marek Sebera Mar 25 '11 at 13:27