Просмотр исходного кода

upload_element with queue supports

m-2k 8 лет назад
Родитель
Сommit
47f0111572
1 измененных файлов с 5 добавлено и 4 удалено
  1. 5 4
      src/elements/element_upload.erl

+ 5 - 4
src/elements/element_upload.erl

@@ -4,10 +4,11 @@
 
 render_element(#upload{id=Id} = U) ->
     Uid = case Id of undefined -> wf:temp_id(); I -> I end,
-    bind(ftp_open,  click,  "qi('upload').click(); e.preventDefault();"),
-    bind(ftp_start, click,  "ftp.start();"),
-    bind(ftp_stop,  click,  "ftp.stop();"),
-    bind(nitro:to_atom(Uid), change, "ftp.init(this.files[0],false);"),
+    wf:wire("ftp_file=undefined;"),
+    bind(ftp_open,  click,  "qi('upload').click(); event.preventDefault();"),
+    bind(ftp_start, click,  "ftp.start(ftp_file);"),
+    bind(ftp_stop,  click,  "ftp.stop(ftp_file);"),
+    bind(nitro:to_atom(Uid), change, "ftp_file=ftp.init(this.files[0]);"),
     Upload = #panel  { body = [
              #input  { id   = Uid,         type    = <<"file">>, style = "display:none" },
              #span   { id   = ftp_status,  body    = [] },