Untitled
plain_text
a month ago
2.3 kB
3
Indexable
Never
alias upload { if ($dialog(upload)) { error Você já está enviando um arquivo. Aguarde concluir o upload atual para enviar outro arquivo. | return } set %uplwindow $1 if (!$isfile($2-)) return if (!$server) { error Você não está conectado | return } set -l %boundary Boundary $+ $base($rand(1, 4503599627370495), 10, 16, 13) set -l %fileSize $file($2-).size set -l %fileName $nopath($2-) if (!$dialog(upload)) { dialog -m upload upload } if ($right(%fileName,4) == .jpg) || ($right(%fileName,4) == .png) || ($right(%fileName,4) == .bmp) || ($right(%fileName,4) == .gif) || ($right(%fileName,5) == .jpeg) || ($right(%fileName,5) == .jfif) { did -g upload 1 $2- } did -ra upload 3 %fileName did -ra upload 5 $round($bytes(%fileSize,k),0) kb bread $qt($2-) 0 %fileSize &file bset -t &body -1 $+(--,%boundary,$crlf) bset -t &body -1 $+(Content-Disposition: form-data; name="file"; filename=",%fileName,",$crlf) ;bset -t &body -1 Content-Type: image/png $+ $crlf bset -t &body -1 $crlf bcopy &body -1 &file 1 -1 bset -t &body -1 $+($crlf,--,%boundary,--,$crlf) bset -t &header -1 $+(content-type: multipart/form-data; boundary=,%boundary,$crlf) bset -t &header -1 $crlf return $urlget(http://0.vern.cc, pbi, &content, uploadCompleted, &header, &body) } alias uploadCompleted { ; echo -s $1 ; echo -s State: $urlget($1).state ; echo -s Header Reply: $urlget($1).reply ; echo -s - ; echo -s Body Reply Length: $bvar(&content, 0) set %upllink $left($bvar(&content, 1-).text,$calc($bvar(&content, 0) - 1)) if ($dialog(upload)) { dialog -x upload } if ($urlget($1).state != ok) { error Falha ao tentar enviar o arquivo. Verifique sua conexão e se está tentando enviar um arquivo válido. } if ($urlget($1).state == ok) { pmsg %uplwindow 75Anexo:59 $+ %upllink } } dialog Upload { title "Upload de arquivo" size -1 -1 111 169 icon sistema\imagens\filesend.ico, 0 option dbu icon 1, 5 4 100 100, sistema\imagens\filesend.png, 0, noborder text "Arquivo:", 2, 5 111 49 8 text "Arquivo.jpg", 3, 5 121 100 8 text "Tamanho:", 4, 5 135 32 8 text "0", 5, 39 135 62 8 text "FAZENDO UPLOAD...", 6, 5 154 101 8, center }