웹 프론트엔드 JS 튜토리얼 Node.js_node.js에서 HTTP를 사용하여 파일을 업로드하는 방법

Node.js_node.js에서 HTTP를 사용하여 파일을 업로드하는 방법

May 16, 2016 pm 03:53 PM
http node

개발환경
개발 환경으로는 Visual Studio Express 2013 for Web을 사용하겠지만 Node.js 개발에는 사용할 수 없습니다. 이를 위해서는 Visual Studio용 Node.js 도구를 설치해야 합니다. 설치 후 웹용 Visual Studio Express 2013은 Node.js IDE 환경으로 변환되어 이 애플리케이션을 만드는 데 필요한 모든 것을 제공합니다. 여기에 제공된 지침에 따라 다음이 필요합니다.

  • Node.js Windows 버전을 다운로드하여 설치하세요. 시스템 플랫폼에 적합한 버전인 Node.js(x86) 또는 Node.js(x64)를 선택하세요.
  •  을 다운로드하여 Node.js용 Visual Studio 도구를 설치하세요.

설치가 완료되면 Visual Studio Express 2013 for Web을 실행하고 Node.js 대화형 창을 사용하여 설치를 확인합니다. Node.js 대화형 창은 보기->다른 Windows-> Node.js Interactive Window 아래에서 찾아보세요. Node.js 대화형 창이 실행된 후 모든 것이 괜찮은지 확인하기 위해 몇 가지 명령을 입력해야 합니다.

2015623103550896.png (626×177)

그림 1 Node.js 대화형 창

이제 설치가 확인되었으므로 GB 수준 파일 업로드를 지원하는 Node.js 데몬 생성을 시작할 준비가 되었습니다. 시작하려면 먼저 새 프로젝트를 생성하고 빈 Node.js 웹 애플리케이션 템플릿을 선택합니다. .

2015623103701380.png (628×384)

그림 2 빈 Node.js 웹 애플리케이션 템플릿을 사용하는 새 프로젝트

프로젝트가 생성되면 솔루션 브라우저에 server.js라는 파일과 노드 패키지 관리자(npm)가 표시됩니다

2015623103722152.png (257×444)

그림 3 솔루션 관리자의 Node.js 애플리케이션

server.js 파일에는 Node.js를 사용하여 기본 Hello World 애플리케이션을 만드는 데 필요한 코드가 포함되어 있습니다.

2015623103740566.png (628×275)

그림 4 Hello World 애플리케이션
이제 계속해서 server.js에서 이 코드를 삭제한 다음 Node.js에 G 수준 파일 업로드를 위한 백엔드 코드를 삽입하겠습니다. 다음으로 npm을 사용하여 이 프로젝트에 필요한 일부 종속성을 설치해야 합니다.

  • Express - 단일 페이지, 다중 페이지 및 하이브리드 웹 애플리케이션 구축을 위한 Node.js 웹 애플리케이션 프레임워크
  • 강력함 - 양식 데이터, 특히 파일 업로드 구문 분석을 위한 Node.js 모듈
  • fs-extra - 파일 시스템 상호 작용 모듈

2015623103757338.png (585×424)

그림 5 npm을 사용하여 필수 모듈 설치

모듈이 설치되면 솔루션 탐색기에서 볼 수 있습니다.

2015623103815638.png (287×488)

그림 6 솔루션 탐색기에는 설치된 모듈이 표시됩니다.

다음 단계에서는 솔루션 탐색기에 새 "Scripts" 폴더를 만들고 "workeruploadchunk.js" 및 "workerprocessfile.js"를 폴더에 추가해야 합니다. 또한 jQuery 2.xSparkMD5 라이브러리를 다운로드하여 "Scripts" 폴더에 추가해야 합니다. 마지막으로 "Default.html" 페이지를 추가해야 합니다.

Node.js 백엔드 생성

먼저 Node.js의 "require()" 기능을 사용하여 백그라운드에서 G 수준 파일을 업로드하는 모듈을 가져와야 합니다. "path" 및 "crypto" 모듈도 가져왔습니다. "경로" 모듈은 업로드된 파일 덩어리에 대한 파일 이름을 생성하는 방법을 제공합니다. "crypto" 모듈은 업로드된 파일의 MD5 체크섬을 생성하는 방법을 제공합니다.

1

2

3

4

5

6

// The required modules 

var express = require('express'); 

var formidable = require('formidable'); 

var fs = require('fs-extra'); 

var path = require('path');

var crypto = require('crypto');

로그인 후 복사

다음 코드 줄은 기적을 목격하는 순간입니다.

코드 복사 코드는 다음과 같습니다.
var app = express();

这行代码是用来创建express应用的。express应用是一个封装了Node.js底层功能的中间件。如果你还记得那个由Blank Node.js Web应用模板创建的"Hello World" 程序,你会发现我导入了"http"模块,然后调用了"http.CreateServer()"方法创建了 "Hello World" web应用。我们刚刚创建的express应用内建了所有的功能。

现在我们已经创建了一个express应用,我们让它呈现之前创建的"Default.html",然后让应用等待连接。

1

2

3

4

5

6

7

8

// Serve up the Default.html page

app.use(express.static(__dirname, { index: 'Default.html' })); 

  

// Startup the express.js application

app.listen(process.env.PORT || 1337); 

  

// Path to save the files

var uploadpath = 'C:/Uploads/CelerFT/';

로그인 후 복사

express应用有app.VERB()方法,它提供了路由的功能。我们将使用app.post()方法来处理"UploadChunk" 请求。在app.post()方法里我们做的第一件事是检查我们是否在处理POST请求。接下去检查Content-Type是否是mutipart/form-data,然后检查上传的文件块大小不能大于51MB。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

// Use the post method for express.js to respond to posts to the uploadchunk urls and

// save each file chunk as a separate file

app.post('*/api/CelerFTFileUpload/UploadChunk*', function(request,response) { 

  

 if (request.method === 'POST') { 

  // Check Content-Type 

  if (!(request.is('multipart/form-data'))){ 

   response.status(415).send('Unsupported media type'); 

   return

  

  

  // Check that we have not exceeded the maximum chunk upload size

  var maxuploadsize =51 * 1024 * 1024; 

  

  if (request.headers['content-length']> maxuploadsize){ 

   response.status(413).send('Maximum upload chunk size exceeded'); 

   return

  }

로그인 후 복사

一旦我们成功通过了所有的检查,我们将把上传的文件块作为一个单独分开的文件并将它按顺序数字命名。下面最重要的代码是调用fs.ensureDirSync()方法,它使用来检查临时目录是否存在。如果目录不存在则创建一个。注意我们使用的是该方法的同步版本。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

// Get the extension from the file name

var extension =path.extname(request.param('filename')); 

  

// Get the base file name

var baseFilename =path.basename(request.param('filename'), extension); 

  

// Create the temporary file name for the chunk

var tempfilename =baseFilename + '.'

request.param('chunkNumber').toString().padLeft('0', 16) + extension + ".tmp"

  

  

// Create the temporary directory to store the file chunk

// The temporary directory will be based on the file name

var tempdir =uploadpath + request.param('directoryname')+ '/' + baseFilename; 

  

// The path to save the file chunk

var localfilepath =tempdir + '/'+ tempfilename; 

  

if (fs.ensureDirSync(tempdir)) { 

 console.log('Created directory ' +tempdir);

}

로그인 후 복사

正如我之前提出的,我们可以通过两种方式上传文件到后端服务器。第一种方式是在web浏览器中使用FormData,然后把文件块作为二进制数据发送,另一种方式是把文件块转换成base64编码的字符串,然后创建一个手工的multipart/form-data encoded请求,然后发送到后端服务器。

所以我们需要检查一下是否在上传的是一个手工multipart/form-data encoded请求,通过检查"CelerFT-Encoded"头部信息,如果这个头部存在,我们创建一个buffer并使用request的ondata时间把数据拷贝到buffer中。

在request的onend事件中通过将buffer呈现为字符串并按CRLF分开,从而从 multipart/form-data encoded请求中提取base64字符串。base64编码的文件块可以在数组的第四个索引中找到。

通过创建一个新的buffer来将base64编码的数据重现转换为二进制。随后调用fs.outputFileSync()方法将buffer写入文件中。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

// Check if we have uploaded a hand crafted multipart/form-data request

// If we have done so then the data is sent as a base64 string

// and we need to extract the base64 string and save it

if (request.headers['celerft-encoded']=== 'base64') { 

  

 var fileSlice = newBuffer(+request.headers['content-length']); 

 var bufferOffset = 0; 

  

 // Get the data from the request

 request.on('data', function (chunk) { 

  chunk.copy(fileSlice , bufferOffset); 

  bufferOffset += chunk.length; 

 }).on('end', function() { 

  // Convert the data from base64 string to binary

  // base64 data in 4th index of the array

  var base64data = fileSlice.toString().split('\r\n'); 

  var fileData = newBuffer(base64data[4].toString(), 'base64'); 

  

  fs.outputFileSync(localfilepath,fileData); 

  console.log('Saved file to ' +localfilepath); 

  

  // Send back a sucessful response with the file name

  response.status(200).send(localfilepath); 

  response.end(); 

 });

}

로그인 후 복사

二进制文件块的上传是通过formidable模块来处理的。我们使用formidable.IncomingForm()方法得到multipart/form-data encoded请求。formidable模块将把上传的文件块保存为一个单独的文件并保存到临时目录。我们需要做的是在formidable的onend事件中将上传的文件块保存为里一个名字。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

else

 // The data is uploaded as binary data. 

 // We will use formidable to extract the data and save it 

 var form = new formidable.IncomingForm(); 

 form.keepExtensions = true; 

 form.uploadDir = tempdir; 

  

 // Parse the form and save the file chunks to the 

 // default location 

 form.parse(request, function (err, fields, files) { 

  if (err){ 

   response.status(500).send(err); 

   return

  

  

 //console.log({ fields: fields, files: files }); 

 }); 

  

 // Use the filebegin event to save the file with the naming convention 

 /*form.on('fileBegin', function (name, file) {

 file.path = localfilepath;

});*/ 

  

form.on('error', function (err) { 

  if (err){ 

   response.status(500).send(err); 

   return

  

 }); 

  

 // After the files have been saved to the temporary name 

 // move them to the to teh correct file name 

 form.on('end', function (fields,files) { 

  // Temporary location of our uploaded file   

  var temp_path = this.openedFiles[0].path; 

  

  fs.move(temp_path , localfilepath,function (err){ 

  

   if (err) { 

    response.status(500).send(err); 

    return

   

   else

    // Send back a sucessful response with the file name 

    response.status(200).send(localfilepath); 

    response.end(); 

   

  }); 

 }); 

  

// Send back a sucessful response with the file name 

//response.status(200).send(localfilepath); 

//response.end(); 

}

}

로그인 후 복사

app.get()方法使用来处理"MergeAll"请求的。这个方法实现了之前描述过的功能。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

// Request to merge all of the file chunks into one file

app.get('*/api/CelerFTFileUpload/MergeAll*', function(request,response) { 

  

 if (request.method === 'GET') { 

  

  // Get the extension from the file name

  var extension =path.extname(request.param('filename')); 

  

  // Get the base file name

  var baseFilename =path.basename(request.param('filename'), extension); 

  

  var localFilePath =uploadpath + request.param('directoryname')+ '/' + baseFilename; 

  

  // Check if all of the file chunks have be uploaded

  // Note we only wnat the files with a *.tmp extension

  var files =getfilesWithExtensionName(localFilePath, 'tmp'

  /*if (err) {

   response.status(500).send(err);

   return;

  }*/

  

  if (files.length !=request.param('numberOfChunks')){ 

   response.status(400).send('Number of file chunks less than total count'); 

   return

  

  

  var filename =localFilePath + '/'+ baseFilename +extension; 

  var outputFile =fs.createWriteStream(filename); 

  

  // Done writing the file

  // Move it to top level directory

  // and create MD5 hash

  outputFile.on('finish', function (){ 

   console.log('file has been written'); 

   // New name for the file

   var newfilename = uploadpath +request.param('directoryname')+ '/' + baseFilename

   + extension; 

  

   // Check if file exists at top level if it does delete it

   //if (fs.ensureFileSync(newfilename)) {

   fs.removeSync(newfilename); 

   //}

  

   // Move the file

   fs.move(filename, newfilename ,function (err) { 

    if (err) { 

     response.status(500).send(err); 

     return

    

    else

     // Delete the temporary directory

     fs.removeSync(localFilePath); 

     varhash = crypto.createHash('md5'), 

      hashstream = fs.createReadStream(newfilename); 

  

     hashstream.on('data', function (data) { 

      hash.update(data) 

     }); 

  

     hashstream.on('end', function (){ 

      var md5results =hash.digest('hex'); 

      // Send back a sucessful response with the file name

      response.status(200).send('Sucessfully merged file ' + filename + ", " 

      + md5results.toUpperCase()); 

      response.end(); 

     }); 

    

   }); 

  }); 

  

  // Loop through the file chunks and write them to the file

  // files[index] retunrs the name of the file.

  // we need to add put in the full path to the file

  for (var index infiles) { 

   console.log(files[index]); 

   var data = fs.readFileSync(localFilePath +'/' +files[index]); 

   outputFile.write(data); 

   fs.removeSync(localFilePath + '/' + files[index]); 

  

  outputFile.end(); 

 }

  

}) ;

로그인 후 복사

注意Node.js并没有提供String.padLeft()方法,这是通过扩展String实现的。

1

2

3

4

5

6

7

8

9

10

11

// String padding left code taken from

// http://www.lm-tech.it/Blog/post/2012/12/01/String-Padding-in-Javascript.aspx

String.prototype.padLeft = function (paddingChar, length) { 

 var s = new String(this); 

 if ((this.length< length)&& (paddingChar.toString().length > 0)) { 

  for (var i = 0; i < (length - this.length) ; i++) { 

   s = paddingChar.toString().charAt(0).concat(s); 

  

 

 return s;

} ;

로그인 후 복사

其中一件事是,发表上篇文章后我继续研究是为了通过域名碎片实现并行上传到CeleFT功能。域名碎片的原理是访问一个web站点时,让web浏览器建立更多的超过正常允许范围的并发连接。 域名碎片可以通过使用不同的域名(如web1.example.com,web2.example.com)或者不同的端口号(如8000, 8001)托管web站点的方式实现。

示例中,我们使用不同端口号托管web站点的方式。

我们使用 iisnode 把 Node.js集成到 IIS( Microsoft Internet Information Services)实现这一点。 下载兼容你操作系统的版本 iisnode (x86) 或者 iisnode (x64)。 下载 IIS URL重写包。

一旦安装完成(假定windows版Node.js已安装),到IIS管理器中创建6个新网站。将第一个网站命名为CelerFTJS并且将侦听端口配置为8000。

2015623103842932.png (546×529)

图片7在IIS管理器中创建一个新网站

然后创建其他的网站。我为每一个网站都创建了一个应用池,并且给应用池“LocalSystem”级别的权限。所有网站的本地路径是C:\inetpub\wwwroot\CelerFTNodeJS。

2015623103905433.png (628×395)

图片8 文件夹层级

我在Release模式下编译了Node.js应用,然后我拷贝了server.js文件、Script文件夹以及node_modules文件夹到那个目录下。
要让包含 iisnode 的Node.js的应用工作,我们需要创建一个web.config文件,并在其中添加如下得内容。


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

<defaultDocument>

 <files>

  <add value="server.js" />

 </files>

 </defaultDocument>

  

 <handlers>

 <!-- indicates that the server.js file is a node.js application to be handled by the 

 iisnode module --> 

 <add name="iisnode" path="*.js" verb="*" modules="iisnode" />

 </handlers>

  

 <rewrite>

 <rules>

  <rule name="CelerFTJS">

  <match url="/*" />

  <action type="Rewrite" url="server.js" />

  </rule>

  

  <!-- Don't interfere with requests for node-inspector debugging --> 

  <rule name="NodeInspector" patternSyntax="ECMAScript" stopProcessing="true">

  <match url="^server.js\/debug[\/]&#63;" />

  </rule>

 </rules>

 </rewrite>

로그인 후 복사

web.config中各项的意思是让iisnode处理所有得*.js文件,由server.js 处理任何匹配"/*"的URL。

2015623103925540.png (628×210)

如果你正确的做完了所有的工作,你就可以通过http://localhost:8000浏览网站,并进入CelerFT "Default.html"页面。

下面的web.config项可以改善 iisnode中Node.js的性能。

复制代码 代码如下:
node_env="production" debuggingEnabled="false" devErrorsEnabled="false" nodeProcessCountPerApplication="0" maxRequestBufferSize="52428800" />

并行上传

为了使用域名碎片来实现并行上传,我不得不给Node.js应用做些修改。我第一个要修改的是让Node.js应用支持跨域资源共享。我不得不这样做是因为使用域碎片实际上是让一个请求分到不同的域并且同源策略会限制我的这个请求。

好消息是XMLttPRequest 标准2规范允许我这么做,如果网站已经把跨域资源共享打开,更好的是我不用为了实现这个而变更在"workeruploadchunk.js"里的上传方法。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

// 使用跨域资源共享 // Taken from http://bannockburn.io/2013/09/cross-origin-resource-sharing-cors-with-a-node-js-express-js-and-sencha-touch-app/

var enableCORS = function(request,response, next){ 

 response.header('Access-Control-Allow-Origin', '*'); 

 response.header('Access-Control-Allow-Methods', 'GET,POST,OPTIONS'); 

 response.header('Access-Control-Allow-Headers', 'Content-Type, Authorization, Content-

     Length, X-Requested-With' ) ;

  

  

 // 拦截OPTIONS方法

 if ('OPTIONS' ==request.method){ 

  response.send(204); 

 

 else

  next(); 

 

} ; 

  

// 在表达式中使用跨域资源共享

app. use ( enableCORS ) ;

로그인 후 복사

为了使server.js文件中得CORS可用,我创建了一个函数,该函数会创建必要的头以表明Node.js应用支持CORS。另一件事是我还需要表明CORS支持两种请求,他们是:

简单请求:

1、只用GET,HEAD或POST。如果使用POST向服务器发送数据,那么发送给服务器的HTTP POST请求的Content-Type应是application/x-www-form-urlencoded, multipart/form-data, 或 text/plain其中的一个。

2、HTTP请求中不要设置自定义的头(例如X-Modified等)

预检请求:

1、使用GET,HEAD或POST以外的方法。假设使用POST发送请求,那么Content-Type不能是application/x-www-form-urlencoded, multipart/form-data, or text/plain,例如假设POST请求向服务器发送了XML有效载荷使用了application/xml or text/xml,那么这个请求就是预检的。

2、在请求中设置自定义头(比如请求使用X-PINGOTHER头)。

在我们的例子中,我们用的是简单请求,所以我们不需要做其他得工作以使例子能够工作。

在 "workeruploadchunk.js" 文件中,我向 self.onmessage 事件添加了对进行并行文件数据块上传的支持.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

// We are going to upload to a backend that supports parallel uploads.

// Parallel uploads is supported by publishng the web site on different ports

// The backen must implement CORS for this to work

else if(workerdata.chunk!= null&& workerdata.paralleluploads ==true){ 

 if (urlnumber >= 6) { 

  urlnumber = 0; 

 

  

 if (urlcount >= 6) { 

  urlcount = 0; 

 

  

 if (urlcount == 0) { 

  uploadurl = workerdata.currentlocation +webapiUrl + urlnumber; 

 

 else

  // Increment the port numbers, e.g 8000, 8001, 8002, 8003, 8004, 8005

  uploadurl = workerdata.currentlocation.slice(0, -1) + urlcount +webapiUrl + 

  urlnumber; 

 

  

 upload(workerdata.chunk,workerdata.filename,workerdata.chunkCount, uploadurl, 

 workerdata.asyncstate); 

 urlcount++; 

 urlnumber++;

 }

로그인 후 복사

이 정보를 파일 업로드 작업자에게 보낼 것이기 때문에 Default.html 페이지에 현재 URL을 저장했습니다.

  • 이 정보를 활용하여 포트 수를 늘리고 싶습니다
  • CORS 요청을 한 후 XMLHttpRequest 객체에 전체 URL을 보내야 합니다.


코드 복사 코드는 다음과 같습니다.

// Save current protocol and host for parallel uploads


"font-family: 'Lucida Console'; font-size: 8pt;">var currentProtocol = window.location.protocol;


"font-family: 'Lucida Console'; font-size: 8pt;">var currentHostandPort = window.location.host;


"font-family: 'Lucida Console'; font-size: 8pt;">var currentLocation = currentProtocol + "//" + currentHostandPort;



아래 코드는 업로드 메시지에 대한 수정 사항을 보여줍니다.



// 웹워커에게 메시지 보내기 및 업로드

"배경색: #ffff99; 글꼴 계열: 'Lucida 콘솔'; 글꼴 크기: 8pt;">케이스< 스팬 스타일="배경색: #ffff99; 글꼴 계열: '루시다 콘솔'; 글꼴 크기: 8pt;"> '업로드'< ;span style="배경 색상: #ffff99; 색상: #339933; 글꼴 계열: 'Lucida 콘솔'; 글꼴 크기: 8pt;">:

// 백엔드가 병렬 업로드를 지원하는지 확인하세요

var 병렬 업로드 =false; 
if ($('#select_parallelupload').prop('checked')) { 
        병렬 업로드 = true; 

 
uploadworkers[data.id].postMessage({ 'chunk': data.blob, 'filename':data.filename, 
'디렉터리': $("#select_directory").val(), 'chunkCount':data.chunkCount, 
'asyncstate':data.asyncstate,'paralleluploads':paralleluploads, '현재 위치': 
currentLocation, 'id': data.id }); 
휴식;

CelerFT는 CelerFT를 接口来支持并行上传.

2015623104005997.png (628×344)

유유한 CelerFT

这个项目的代码可以再我的 github 资源库上找到

본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

Video Face Swap

Video Face Swap

완전히 무료인 AI 얼굴 교환 도구를 사용하여 모든 비디오의 얼굴을 쉽게 바꾸세요!

뜨거운 도구

메모장++7.3.1

메모장++7.3.1

사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전

SublimeText3 중국어 버전

중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기

스튜디오 13.0.1 보내기

강력한 PHP 통합 개발 환경

드림위버 CS6

드림위버 CS6

시각적 웹 개발 도구

SublimeText3 Mac 버전

SublimeText3 Mac 버전

신 수준의 코드 편집 소프트웨어(SublimeText3)

http 상태 코드 520은 무엇을 의미합니까? http 상태 코드 520은 무엇을 의미합니까? Oct 13, 2023 pm 03:11 PM

HTTP 상태 코드 520은 서버가 요청을 처리하는 동안 알 수 없는 오류가 발생하여 더 구체적인 정보를 제공할 수 없음을 의미합니다. 서버가 요청을 처리하는 동안 알 수 없는 오류가 발생했음을 나타내는 데 사용됩니다. 이는 서버 구성 문제, 네트워크 문제 또는 기타 알 수 없는 이유로 인해 발생할 수 있습니다. 이는 일반적으로 서버 구성 문제, 네트워크 문제, 서버 과부하 또는 코딩 오류로 인해 발생합니다. 상태 코드 520 오류가 발생하면 웹사이트 관리자나 기술 지원팀에 문의하여 자세한 정보와 지원을 받는 것이 가장 좋습니다.

http 상태 코드 403이란 무엇입니까? http 상태 코드 403이란 무엇입니까? Oct 07, 2023 pm 02:04 PM

HTTP 상태 코드 403은 서버가 클라이언트의 요청을 거부했음을 의미합니다. http 상태 코드 403에 대한 해결 방법은 다음과 같습니다. 1. 서버에 인증이 필요한 경우 올바른 자격 증명이 제공되었는지 확인합니다. 2. 서버가 IP 주소를 제한한 경우 클라이언트의 IP 주소가 제한되어 있거나 블랙리스트에 없습니다. 3. 파일 권한 설정을 확인하십시오. 403 상태 코드가 파일 또는 디렉토리의 권한 설정과 관련되어 있으면 클라이언트가 해당 파일 또는 디렉토리에 액세스할 수 있는 권한이 있는지 확인하십시오. 등.

웹 페이지 리디렉션의 일반적인 애플리케이션 시나리오를 이해하고 HTTP 301 상태 코드를 이해합니다. 웹 페이지 리디렉션의 일반적인 애플리케이션 시나리오를 이해하고 HTTP 301 상태 코드를 이해합니다. Feb 18, 2024 pm 08:41 PM

HTTP 301 상태 코드의 의미 이해: 웹 페이지 리디렉션의 일반적인 응용 시나리오 인터넷의 급속한 발전으로 인해 사람들은 웹 페이지 상호 작용에 대한 요구 사항이 점점 더 높아지고 있습니다. 웹 디자인 분야에서 웹 페이지 리디렉션은 HTTP 301 상태 코드를 통해 구현되는 일반적이고 중요한 기술입니다. 이 기사에서는 HTTP 301 상태 코드의 의미와 웹 페이지 리디렉션의 일반적인 응용 프로그램 시나리오를 살펴봅니다. HTTP301 상태 코드는 영구 리디렉션(PermanentRedirect)을 나타냅니다. 서버가 클라이언트의 정보를 받을 때

PI 노드 교육 : PI 노드 란 무엇입니까? Pi 노드를 설치하고 설정하는 방법은 무엇입니까? PI 노드 교육 : PI 노드 란 무엇입니까? Pi 노드를 설치하고 설정하는 방법은 무엇입니까? Mar 05, 2025 pm 05:57 PM

Pinetwork 노드에 대한 자세한 설명 및 설치 안내서이 기사에서는 Pinetwork Ecosystem을 자세히 소개합니다. Pi 노드, Pinetwork 생태계의 주요 역할을 수행하고 설치 및 구성을위한 전체 단계를 제공합니다. Pinetwork 블록 체인 테스트 네트워크가 출시 된 후, PI 노드는 다가오는 주요 네트워크 릴리스를 준비하여 테스트에 적극적으로 참여하는 많은 개척자들의 중요한 부분이되었습니다. 아직 Pinetwork를 모른다면 Picoin이 무엇인지 참조하십시오. 리스팅 가격은 얼마입니까? PI 사용, 광업 및 보안 분석. Pinetwork 란 무엇입니까? Pinetwork 프로젝트는 2019 년에 시작되었으며 독점적 인 Cryptocurrency Pi Coin을 소유하고 있습니다. 이 프로젝트는 모든 사람이 참여할 수있는 사람을 만드는 것을 목표로합니다.

Nginx 프록시 관리자를 사용하여 HTTP에서 HTTPS로 자동 점프를 구현하는 방법 Nginx 프록시 관리자를 사용하여 HTTP에서 HTTPS로 자동 점프를 구현하는 방법 Sep 26, 2023 am 11:19 AM

NginxProxyManager를 사용하여 HTTP에서 HTTPS로의 자동 점프를 구현하는 방법 인터넷이 발전하면서 점점 더 많은 웹사이트가 HTTPS 프로토콜을 사용하여 데이터 전송을 암호화하여 데이터 보안과 사용자 개인 정보 보호를 향상시키기 시작했습니다. HTTPS 프로토콜에는 SSL 인증서 지원이 필요하므로 HTTPS 프로토콜 배포 시 특정 기술 지원이 필요합니다. Nginx는 강력하고 일반적으로 사용되는 HTTP 서버 및 역방향 프록시 서버이며 NginxProxy

http.PostForm 함수를 사용하여 양식 데이터와 함께 POST 요청 보내기 http.PostForm 함수를 사용하여 양식 데이터와 함께 POST 요청 보내기 Jul 25, 2023 pm 10:51 PM

http.PostForm 함수를 사용하여 양식 데이터와 함께 POST 요청을 보낼 수 있습니다. Go 언어의 http 패키지에서는 http.PostForm 함수를 사용하여 양식 데이터와 함께 POST 요청을 보낼 수 있습니다. http.PostForm 함수의 프로토타입은 다음과 같습니다: funcPostForm(urlstring,dataurl.Values)(resp*http.Response,errerror)where, u

빠른 적용: 여러 파일의 PHP 비동기 HTTP 다운로드에 대한 실제 개발 사례 분석 빠른 적용: 여러 파일의 PHP 비동기 HTTP 다운로드에 대한 실제 개발 사례 분석 Sep 12, 2023 pm 01:15 PM

빠른 적용: PHP의 실제 개발 사례 분석 여러 파일의 비동기 HTTP 다운로드 인터넷의 발전으로 파일 다운로드 기능은 많은 웹 사이트와 응용 프로그램의 기본 요구 사항 중 하나가 되었습니다. 여러 파일을 동시에 다운로드해야 하는 시나리오의 경우 기존 동기 다운로드 방법은 비효율적이고 시간이 많이 걸리는 경우가 많습니다. 이러한 이유로 PHP를 사용하여 HTTP를 통해 여러 파일을 비동기적으로 다운로드하는 것이 점점 더 일반적인 솔루션이 되었습니다. 본 글에서는 실제 개발 사례를 통해 PHP 비동기 HTTP를 활용하는 방법을 자세히 분석해 보겠습니다.

C#의 일반적인 네트워크 통신 및 보안 문제와 솔루션 C#의 일반적인 네트워크 통신 및 보안 문제와 솔루션 Oct 09, 2023 pm 09:21 PM

C#의 일반적인 네트워크 통신 및 보안 문제와 해결 방법 오늘날 인터넷 시대에 네트워크 통신은 소프트웨어 개발에 없어서는 안 될 부분이 되었습니다. C#에서는 일반적으로 데이터 전송 보안, 네트워크 연결 안정성 등과 같은 일부 네트워크 통신 문제가 발생합니다. 이 문서에서는 C#의 일반적인 네트워크 통신 및 보안 문제에 대해 자세히 설명하고 해당 솔루션과 코드 예제를 제공합니다. 1. 네트워크 통신 문제 네트워크 연결 중단: 네트워크 통신 과정에서 네트워크 연결이 중단될 수 있으며, 이로 인해

See all articles