Thursday, 15 August 2013

debugging - JQuery Template Engine Half-Works in Chrome,Safari,Firefox -


Simple questions, but probabbly complex answers. I am using the BluImp JQuery file-uploader I've customized the templates so that the files with a very long name do not mess around my webpage. Here's an example of a code that I do.

  & lt ;! - Template to display files available for upload - & gt; & Lt; Script id = "template-upload" type = "text / x-tmpl" & gt; (% I16) + "..."; %} & Lt; Tr class = "template-upload fade" & gt; & Lt; Td class = "name" & gt; & Lt; Span & gt; {% = File.name%} & lt; / Span & gt; & Lt; / Td> {% If (file.error) {%} & lt; Td class = "error" colspan = "2" & gt; & Lt; Span class = "label label-important" & gt; Error & lt; / Span & gt; {% = File.error%} & lt; / TD & gt; (% I & lt; div class = "progress progress-progress progress-striped active" role = "progress bar" aria-valuemin = "0" aria-valuemax = "100" aria-valuenow = "0" & ​​gt; ; & Lt; div class = "bar" style = "width: 0%;" & gt; & lt; / div & gt; & lt; / div & gt; & lt; / td & gt; & lt; td & Gt; {% if (! O.options.autoUpload) {%} & lt; button class = "BTN BTN-Primary Start" & gt; & lt; i class = "icon-upload icon-black" & gt; & Lt; / i & gt; & lt; Period & gt; Start & lt; / span & gt; & lt; / button & gt; {%}%} & lt; / td & gt; {%} Other {%}  %   cancel & lt; / span & lt; / i & gt; Gt; & lt; / button & gt; {%}%} & lt; / td & gt; & lt; / tr & gt; {%}%} & lt; / script & gt; & lt ;! - download Template for displaying files available - & gt; & lt; script id = "template-download" type = "text / x-tmpl" & gt; (% I16) + "..."; %} & Lt; Tr class = "template-download fade" & gt; {% If (file.error) {%} & lt; TD & gt; & Lt; / Td> & Lt; Td class = "name" & gt; & Lt; Span & gt; {% = File.name%} & lt; / Span & gt; & Lt; / Td> & Lt; Td square = "size" & gt; & Lt; Span & gt; {% = O.formatFileSize}%} & lt; / Span & gt; & Lt; / Td> & Lt; Td square = "error" colspan = "2" & gt; & Lt; Span class = "label label-important" & gt; Error & lt; / Span & gt; {% = File.error%} & lt; / Td> {%} Other {%} & lt; Td class = "name" & gt; {% = File.name%} & lt; / Td> & Lt; Td square = "size" & gt; & Lt; Span & gt; {% = O.formatFileSize}%} & lt; / Span & gt; & Lt; / Td> & Lt; Td colspan = "1" & gt; & Lt; / Td> {%}%} & Lt; Td width = "130px;" & Gt; & Lt; Button class = "btn btn-danger delete" data-type = "{% = file.delete_type%}" data-url = "{% = file.delete_url%}" {% if (file.delete_with_credentials) {%} data -exer-field = '{"with credential": true}' {%}%} & gt; & Lt; I class = "icon-trash-mark-black" & gt; & Lt; / I & gt; & Lt; Period & gt; Remove & lt; / Span & gt; & Lt; / Button & gt; & Lt; Input type = "checkbox" name = "delete" value = "1" square = "toggle" & gt; & Lt; / TD & gt; & Lt; / TR & gt; {%}%} & Lt; / Script & gt;   

The filename formatting always works in IE. In all other browsers, only download template works ie File name is merged after uploading the file. So, how can I name the file before uploading to other browsers?

Regular expression to trim it regularly, such as the following for Windows path:

  .replace (/ [^ \\] + \ \ / g, "");    

No comments:

Post a Comment