-2

I am beginner with php.

I found out that the best tool to work with MySQL database and files is php.

So I need to get file from 'file_name'

<input type=file name="file_name">

and to save this file into another place. For example at d:/folder/

Tell me please how can I do it in php. Or there is another way to solve this issue

SO-user
  • 1,458
  • 2
  • 21
  • 43
Saidalo
  • 31
  • 1
  • 6

2 Answers2

0
$target_dir = "uploads/"; // folder path
$target_file = $target_dir . basename($_FILES["fileToUpload"]["file_name"]);
move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file);

follow this tutorial: http://www.w3schools.com/php/php_file_upload.asp

SO-user
  • 1,458
  • 2
  • 21
  • 43
0

Make sure to add enctype="multipart/form-data" in html form tag. Otherwise you won't get $_FILE arr

bravo
  • 131
  • 2
  • 12