Hướng dẫn php move uploaded file to another server - php di chuyển tệp đã tải lên sang máy chủ khác

Lấy tệp đã tải lên, di chuyển nó đến một vị trí tạm thời và đẩy nó đến bất kỳ FTP-Acount nào bạn muốn.

$tempName = tempnam(sys_get_temp_dir(), 'upload');
move_uploaded_file($_FILES["file"]["tmpname"], $tempName);

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($uploadedFile));
fclose($handle);
unlink($tempName);

Trên thực tế, bạn thậm chí không cần bộ phận với move_uploaded_file. Việc lấy tệp đã tải lên hoàn toàn là hoàn toàn hợp lý và viết nội dung vào tệp được mở bằng fopen. Để biết thêm thông tin về việc mở URL với fopen, hãy xem tài liệu PHP. Để biết thêm thông tin về việc tải lên các tệp, hãy xem phần tải trọng tệp của thủ công PHP

[Chỉnh sửa] Đã thêm file_get_contents vào ví dụ mã Added file_get_contents to the code-example

[Chỉnh sửa] Ví dụ ngắn hơn Shorter Example

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.

14 năm trước

Bogusred ¶Moves an uploaded file to a new location

gotrunko tại hotmail dot com

Mikelone ¶(string $from, string $to): bool

Wilcobeekhuizen tại Gmail Dot Com ¶

Tom ¶

7 năm trước

Ray.paseur đôi khi sử dụng gmail ¶

Espiao tại gmail dot com

Sauron tại Nospam trên Morannon Dot org ¶

18 năm trước

Thông tin tại Arpadh Dot Hu ¶

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
0 on success.

booc0mtaco tại gmail dot commove_uploaded_file() will return

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
2.

agan0052 tại hotmail dot commove_uploaded_file() will return

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
2. Additionally, a warning will be issued.

Sergeygrinev tại mail dot ru ¶

chatchaw tại tot dot co dot th ¶

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
5

Ghi chú

Ghi chú::

Move_Uploaded_file () là Open_basingir Aware. Tuy nhiên, các hạn chế chỉ được đặt trên đường dẫn to để cho phép di chuyển các tệp được tải lên trong đó from có thể mâu thuẫn với các hạn chế đó. Move_uploaded_file () đảm bảo sự an toàn của hoạt động này bằng cách chỉ cho phép các tệp đó được tải lên thông qua PHP được di chuyển. is open_basedir aware. However, restrictions are placed only on the to path as to allow the moving of uploaded files in which from may conflict with such restrictions. move_uploaded_file() ensures the safety of this operation by allowing only those files uploaded through PHP to be moved.

Cảnh báo

Nếu tệp đích đã tồn tại, nó sẽ bị ghi đè.

Xem thêm

  • is_uploaded_file () - cho biết liệu tệp có được tải lên qua bài đăng http
  • Đổi tên () - Đổi tên một tệp hoặc thư mục
  • Xem tải lên tệp xử lý để biết ví dụ sử dụng đơn giản

Yousef Ismaeil cliprz ¶

9 năm trước

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
8

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
9

move_uploaded_file0

move_uploaded_file1

move_uploaded_file2

move_uploaded_file3

move_uploaded_file4

move_uploaded_file5

move_uploaded_file6

move_uploaded_file7

move_uploaded_file8

move_uploaded_file9

fopen0

Dan Delaney ¶

14 năm trước

fopen1

Juliano P. Santos ¶

3 năm trước

fopen2

Zarel ¶

16 năm trước

fopen3

fopen4

fopen5

fopen6

fopen7

Florian S. ở H. An der E. [.de] ¶

14 năm trước

fopen8

fopen9

fopen0

Juliano P. Santos ¶

3 năm trước

fopen1

Zarel ¶

16 năm trước

fopen2

fopen3

fopen4

fopen5

fopen6

fopen0

Florian S. ở H. An der E. [.de] ¶

nlgordon tại iastate dot edu ¶

fopen8

15 năm trước

Mancow tại MacFilez Dot Net

fopen9

ccbsschucko tại gmail dot com ¶

3 năm trước

file_get_contents0

file_get_contents1

file_get_contents2

fopen0

Zarel ¶

16 năm trước

file_get_contents4

file_get_contents5

fopen0

Florian S. ở H. An der E. [.de] ¶

nlgordon tại iastate dot edu ¶

file_get_contents7

file_get_contents8

file_get_contents9

$from0

$from1

$from2

$from3

$from4

15 năm trước

Mancow tại MacFilez Dot Net

$from5

ccbsschucko tại gmail dot com ¶

3 năm trước

$from6

Zarel ¶

16 năm trước

$from7

Florian S. ở H. An der E. [.de] ¶

nlgordon tại iastate dot edu ¶

$from8

$from9

$to0

$to1

$to2

$to3

fopen0

15 năm trước

Mancow tại MacFilez Dot Net

$to5

ccbsschucko tại gmail dot com ¶

14 năm trước

$to6

$to7

$to8

fopen0

Juliano P. Santos ¶

3 năm trước

from0

from1

from2

from3

fopen0

Zarel ¶

nlgordon tại iastate dot edu ¶

from5

from6

from7

from8

15 năm trước

Mancow tại MacFilez Dot Net

from9

to0

to1

to2

to3

fopen0

ccbsschucko tại gmail dot com ¶

Mancow tại MacFilez Dot Net

to5

ccbsschucko tại gmail dot com ¶

4 năm trước

to6

to7

to8

fopen0

Jest3r tại Mtonic Dot Net

nlgordon tại iastate dot edu ¶

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
00

15 năm trước

Mancow tại MacFilez Dot Net

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
01

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
02

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
03

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
04

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
05

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
06

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
07

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
08

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
09

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
10

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
11

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
12

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
13

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
14

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
15

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
16

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
17

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
18

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
19

fopen0

ccbsschucko tại gmail dot com ¶

4 năm trước

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
21

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
22

fopen0

Jest3r tại Mtonic Dot Net

3 năm trước

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
24

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
25

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
26

fopen0

Zarel ¶

3 năm trước

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
28

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
29

fopen0

Zarel ¶

14 năm trước

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
31

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
32

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
33

Juliano P. Santos ¶

16 năm trước

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
34

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
35

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
36

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
37

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
38

fopen0

Florian S. ở H. An der E. [.de] ¶

nlgordon tại iastate dot edu ¶

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
40

15 năm trước

3 năm trước

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
41

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
42

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
43

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
44

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
45

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
46

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
47

fopen0

Zarel ¶

3 năm trước

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
49

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
50

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
51

fopen0

Zarel ¶

Mancow tại MacFilez Dot Net

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
53

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
54

fopen0

ccbsschucko tại gmail dot com ¶

4 năm trước

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
56

$handle = fopen("ftp://user:/somefile.txt", "w");
fwrite($handle, file_get_contents($_FILES["file"]["tmpname"]);
fclose($handle);
// As the uploaded file has not been moved from the temporary folder 
// it will be deleted from the server the moment the script is finished.
// So no cleaning up is required here.
57

fopen0

Làm cách nào để chuyển tệp từ máy chủ này sang máy chủ khác trong PHP?

$ file, "wb"); $ nguồn = file_get_contents ($ file); fwrite ($ Destination, $ Source, Strlen ($ Source)); fclose ($ Destination); Hình ảnh cần được chuyển sang máy chủ FTP ...
Khởi tạo một phiên trước ..
Các tùy chọn chuyển mong muốn có thể được đặt ..
Việc chuyển nhượng có thể được thực hiện ..
Phiên có thể được đóng ..

Chức năng nào bạn có thể sử dụng để chuyển một tệp đã tải lên một vị trí mới PHP?

Php Move_upLoaded_File () Hàm hàm Move_uploaded_file () di chuyển một tệp đã tải lên một điểm đến mới. Lưu ý: Chức năng này chỉ hoạt động trên các tệp được tải lên thông qua cơ chế tải lên bài HTTP của PHP. Lưu ý: Nếu tệp đích đã tồn tại, nó sẽ bị ghi đè.move_uploaded_file() Function The move_uploaded_file() function moves an uploaded file to a new destination. Note: This function only works on files uploaded via PHP's HTTP POST upload mechanism. Note: If the destination file already exists, it will be overwritten.

Làm thế nào để tải lên tệp trong thư mục cụ thể trong PHP?

Tạo tập lệnh tải lên tập lệnh PHP $ target_dir = "Tải lên/" - Chỉ định thư mục nơi tệp sẽ được đặt.$ target_file chỉ định đường dẫn của tệp sẽ được tải lên.$ uploadok = 1 chưa được sử dụng (sẽ được sử dụng sau) $ ImageFileType giữ phần mở rộng tệp của tệp (trong trường hợp thường)$target_dir = "uploads/" - specifies the directory where the file is going to be placed. $target_file specifies the path of the file to be uploaded. $uploadOk=1 is not used yet (will be used later) $imageFileType holds the file extension of the file (in lower case)

PHP sử dụng vị trí nào làm mặc định khi các tệp ban đầu được tải lên?

Các tệp được tải lên trước tiên được lưu trữ trong một thư mục tạm thời (đừng lo lắng, tập lệnh PHP của bạn có thể di chuyển các tệp đến một vị trí lâu dài hơn sau đó).Theo mặc định, vị trí ban đầu là thư mục tạm thời mặc định của hệ thống.Bạn có thể chỉ định một thư mục khác bằng cách sử dụng Chỉ thị Upload_TMP_DIR trong PHP.the system's default temporary directory. You can specify a different directory using the upload_tmp_dir directive in php.