Reputation: 88
Whats wrong with this code?
<?php
move_uploaded_file($_FILES['file']['tmp_name']."picture/".$_FILES['file']['name']);
?>
<form action='' method='post' enctype='multipart/form-data'>
<input type='file' name='file'>
<input type='submit' name='submit' value='Upload'>
</form>
I'm getting this error: Warning: move_uploaded_file() expects exactly 2 parameters, 1 given in C:\xampp\htdocs\social\profile.php on line 3
Upvotes: 0
Views: 2231
Reputation: 7269
See the docs. Move-uploaded-file function have to pass 2 parameters:
string $filename
string $destination
Also, I assume you have mistake in your function. There are 2 params, but you concat them, not separate. Use ,
insteald of .
before "/pictures/"
:
move_uploaded_file($_FILES['file']['tmp_name'], "picture/".$_FILES['file']['name']);
This will work.
Upvotes: 1
Reputation: 4635
Your full stop before "picture/" should be a comma to separate the parameters, guessing a typo
<?php
move_uploaded_file($_FILES['file']['tmp_name'], "picture/".$_FILES['file']['name']);
?>
<form action='' method='post' enctype='multipart/form-data'>
<input type='file' name='file'>
<input type='submit' name='submit' value='Upload'>
</form>
Upvotes: 0