라이브러리

[PHP_CONFIG] uploadprogress.file.filename_template - 업로드 진행 상태 추적의 파일 이름 템플릿 설정




PHP CONFIG 에서 uploadprogress.file.filename_template

`uploadprogress.file.filename_template`는 PHP의 `uploadprogress` 모듈에서 사용되는 설정 변수입니다. 이 변수는 업로드 중인 파일의 이름을 생성할 때 사용하는 템플릿을 지정합니다.

기본적으로 `uploadprogress` 모듈은 업로드 중인 파일의 이름을 `upload_`로 시작하는 이름으로 생성합니다. 예를 들어, 업로드 중인 파일의 이름이 `example.txt`라면 `upload_example.txt`로 생성됩니다.

하지만, `uploadprogress.file.filename_template` 설정 변수를 사용하면 업로드 중인 파일의 이름을 생성할 때 사용하는 템플릿을 변경할 수 있습니다.

설정 변수의 형식

`uploadprogress.file.filename_template` 설정 변수의 형식은 다음과 같습니다.

`uploadprogress.file.filename_template = "템플릿"`

템플릿은 다음과 같은 변수를 포함할 수 있습니다.

* `%f`: 업로드 중인 파일의 이름
* `%t`: 업로드 중인 파일의 타입 (확장자)
* `%u`: 업로드 중인 파일의 UUID
* `%n`: 업로드 중인 파일의 이름 (원래 이름)
* `%s`: 업로드 중인 파일의 크기 (바이트)

예제

다음 예제에서는 `uploadprogress.file.filename_template` 설정 변수를 사용하여 업로드 중인 파일의 이름을 생성하는 방법을 보여줍니다.

#hostingforum.kr
php

// uploadprogress.module.ini 파일에 설정 변수 추가

uploadprogress.file.filename_template = "%f_%t"



// 업로드 중인 파일의 이름을 생성하는 예제

$file_name = "example.txt";

$file_type = "txt";

$file_uuid = "12345678-1234-1234-1234-123456789012";

$file_original_name = "example.txt";

$file_size = 1024;



$filename = sprintf(uploadprogress.file.filename_template, $file_name, $file_type);

echo $filename; // output: example_txt



위 예제에서는 `uploadprogress.file.filename_template` 설정 변수를 사용하여 업로드 중인 파일의 이름을 생성합니다. 템플릿에 `%f`와 `%t` 변수를 사용하여 파일 이름과 타입을 포함합니다.

결론

`uploadprogress.file.filename_template` 설정 변수를 사용하여 업로드 중인 파일의 이름을 생성할 수 있습니다. 이 설정 변수를 사용하면 업로드 중인 파일의 이름을 생성할 때 사용하는 템플릿을 변경할 수 있습니다. 템플릿에는 `%f`, `%t`, `%u`, `%n`, `%s` 변수를 포함할 수 있습니다.
  • profile_image
    나우호스팅 @pcs8404 

    호스팅포럼 화이팅!

    댓글목록

    등록된 댓글이 없습니다.

  • 전체 10,077건 / 30 페이지

검색

게시물 검색