小编Max*_*ark的帖子

为什么 HttpEventType.UploadProgress 事件在 Angular 文件上传请求中只执行一次?

我正在尝试从 angular 上传文件。我也想显示上传进度。

上传服务.ts

public uploadProductImage(obj: FormData, id: string) {
    return this._http.post(baseUrl + `/product/upload`, obj, {
      headers: {
        product_id: id,
      },
      reportProgress : true,
      observe : 'events'
    });
  }
Run Code Online (Sandbox Code Playgroud)

上传.component.ts

uploadClick() {
    const fd = new FormData();

    // for(const f of this.file_url) {
    //   fd.append('image', f.file, f.file.name);
    // }
    fd.append('image', this.file_url[0].file, this.file_url[0].file.name);
    this.service.uploadProductImage(fd, this.product_id.toString())
      .subscribe(
        event => {
          if (event.type === HttpEventType.UploadProgress) {
            console.log(event.loaded, event.total);
            this.progress = Math.round(event.loaded / event.total * 100);

          } else if (event.type === HttpEventType.Response) {
            console.log(event.body); …
Run Code Online (Sandbox Code Playgroud)

file-upload typescript angular

5
推荐指数
2
解决办法
1751
查看次数

将批处理文件转换为exe后,Windows Defender将文件显示为木马为什么?

我写了一个批处理脚本来删除USB驱动器中的快捷方式病毒,并显示隐藏的文件夹和文件.

@ECHO OFF
TITLE SHORTCUT VIRUS REMOVER
ECHO SHORTCUT VIRUS TEMPORARY REMOVER
ECHO THIS TOOL IS MADE BY BHARGAB(MAXYSPARK)
SET /P DRIVE=ENTER THE DRIVE LEETER 
CD /D %DRIVE%:
DEL *.LNK
ATTRIB -H -R -S /S /D /L %DRIVE%:\*.*
PAUSE
Run Code Online (Sandbox Code Playgroud)

但在使用Bat To Exe Converter将批处理(.bat)文件转换为.exe文件后,.exe文件被检测为木马病毒为什么???? Windows后卫的屏幕截图

我已经允许Windows防御者中的文件.

windows antivirus virus batch-file trojan

4
推荐指数
1
解决办法
7431
查看次数

如何从头开始重复 ac 程序并清理屏幕和第一个输入值?

我是编程新手。我写了一个简单的程序。我想一次又一次地重复该程序,并且只有当用户想要退出时它才能退出。这是我的程序

#include<stdio.h>
#include<conio.h>
main()
{
    char ch;
    int num1, num2, a, m, s, choice;
    float d;
    printf("\nEnter The First Number: ");
    scanf("%d", &num1);
    printf("\nEnter The Second Number: ");
    scanf("%d", &num2);
    a=num1+num2;
    m=num1*num2;
    s=num1-num2;
    d=(float)(num1/num2);
    printf("\nEnter Your Choice \nFor Addition Type A \nFor Multipication Type M \nFor Division Type D \nFor Substraction Type S : ");
    scanf(" %c", &ch);
    switch(ch)
        {
            case 'A': printf("\nThe Addition Of The Number Is= %d", a);
                break;
            case 'M': printf("\nThe Multipication Of The Numbers Is= %d", …
Run Code Online (Sandbox Code Playgroud)

c loops console-application

3
推荐指数
1
解决办法
4万
查看次数

NodeJS模块'request'返回一些符号而不是html

我正在学习Nodejs,并尝试使用node.js进行网络报废

我正在使用节点模块requestcheerio

但是当我请求url时,它会返回一些符号而不是html正文

var request = require('request');
var cheerio = require('cheerio');
request({
    url:"http://mangafox.me/manga/shingeki_no_kyojin/v00/c000/1.html"
},(err, res, body) => {
    if(err) throw err;

    else {
        var $ = cheerio.load(body);
        console.log(body);
        }
});
Run Code Online (Sandbox Code Playgroud)

在命令提示符下输出

在此输入图像描述

谁能告诉我这里有什么问题?

谢谢

javascript node.js npm cheerio requestjs

0
推荐指数
1
解决办法
400
查看次数