Skip to content

Instantly share code, notes, and snippets.

@henriquehorbovyi
Created March 7, 2018 17:24
Show Gist options
  • Select an option

  • Save henriquehorbovyi/e804053bbdd7b8ec437792a22469557a to your computer and use it in GitHub Desktop.

Select an option

Save henriquehorbovyi/e804053bbdd7b8ec437792a22469557a to your computer and use it in GitHub Desktop.
for($i=0; $i<count($_FILES['file']['name']); $i++) {
$tmpFilePath = $_FILES['file']['tmp_name'][$i];
$shortname = $_FILES['file']['name'][$i];
$filename = date('YmdHis').$_FILES['file']['name'][$i];
$filePath = "./public/course_work/".$filename;
$ext = pathinfo($_FILES['file']['name'][$i], PATHINFO_EXTENSION);
$file = basename($shortname,".".$ext);
if(move_uploaded_file($tmpFilePath, $filePath))
{
//do something...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment