$name = $_FILES['myfile'] ['name'];
$tmp_name = $_FILES ['myfile'] ['tmp_name'];

i wont to know why the variable $name, is begin with name
can somebody explain me this variables and parameters.

Recommended Answers

All 5 Replies

$name = $_FILES['myfile'] ['name']; will assign new name to the uploaded file. where $tmp_name = $_FILES ['myfile'] ['tmp_name']; will get the temp name of the uploaded file.

Suppose if you upload a file the system will automatically uploaded it to temp folder and it will assign some random code. That name you will get via $_FILES['myfile']['tmp_name'];

If you want to assign a new name for the uploaded file you can try

$_FILES['myfile']['name'] = date("YmdHms");
// Here it will assign timestamp to the new name
move_uploaded_file($_FILES['myfile']['tmp_name'], "uploads/".$_FILES['myfile']['name']);
// It will move the temporary uploaded file with new name i.e timestamp to the uploaded folder.

y are so kind. thnx

@krishwebdesign so this are just for the names

@Andyy121 Sharing knowledge is very important dude. Yah they are just for the names

$name = $_FILES['myfile'] ['name'];
$tmp_name = $_FILES ['myfile'] ['tmp_name'];

Where as $name and $tmp_name are the variables.

You can use any name
ex:-

$original_name = $_FILES['myfile']['name'];
$temp_name = $_FILES['myfile']['tmp_name'];

im not going to build the atomic bomb i was asking just for knowing

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.