Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-07-2012, 05:33 AM   PM User | #1
bluey
New to the CF scene

 
Join Date: Jul 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
bluey is an unknown quantity at this point
a little stuck on a simple problem meh

hi just working on an upload script using ajax and js which user uploads file and then output url appears on completion.

works fine with images, but not with mp3 / wav, ive located the code where i believe sorts the extension types, but even after a lot of googling, i cannot seem to come up with how to allow mp3 and wav.

Code:
   */
        window.dropFile = function () {
            // Instantly hide the SilverLight Application
            hide(true);
            // Drop the file
            // We are trying to recreate an event here... 
            // this is very hacky and means we have to recreate everything in a typical event otherwise we can break code
            var dataTransfer = { files: [] };

            for (var i = 0; i < arguments.length; i++) {
                     // filename
                var name = arguments[i].split(',')[0],
                    // data
                    base64 = arguments[i].split(',')[1],
                    // mime type based upon extension
                    mime = { png: "image/png",
                        jpg: "image/jpeg",
                        jpeg: "image/jpeg",
                        gif: "image/gif"
                    }[name.match(/[^\.]*$/)[0]] || "";

                dataTransfer.files[i] = { name: name, size: base64.length, data: base64, type : mime }
            }

I can show as much code as needed, im a newby to js and ajax, but semi confident coder in other langs.


Any advice would be great cheers

bluey
bluey is offline   Reply With Quote
Reply

Bookmarks

Tags
bluey

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:09 PM.


Advertisement
Log in to turn off these ads.