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