Reputation: 357
I have a problem with uploading file with PHP. The html code is
<form enctype="multipart/form-data" id="form" action="action.php">
<input type="file" name="file"/><br/><br/>
<input type="submit" id="upload" value="Upload"/>
</form>
and the PHP segment is
if($_FILES["file"]["error"]>0){
$result['status'] = -1;
$result['message'] = 'Unknown Error';
}
else{
$file = $_FILES["file"];
$savepath = '/CSV Files/'.$file["name"];
move_uploaded_file($file['tmp_name'],$savepath);
}
The problem is the $result['status']
is not -1, but the $file
is a null. And the strange thing is, the code worked well days ago, and suddenly died recently.Hope somebody could help me out. Thanks a lot!
Upvotes: 0
Views: 68
Reputation: 22711
You have missed to add method="POST"
in your <form>
tag
<form method="POST" enctype="multipart/form-data" id="form" action="design.php">
^^^^^^^^^^^^^
Upvotes: 1