I’m writing a custom plugin to import data from a custom xml to a WordPress database. After activating plugin and uploading xml file, it is showing error “sorry, only xml files are allowed”. I have used only xml file. but I’m not sure why the file is not getting uploaded to location. I echoed location and file name, but file name is not being displayed. I’m using php code for upload section. not sure I’m following right way. here is the snapshot and code
Here is the code url: code here
It seems you’ve not used
enctype="multipart/form-data"
which may be the first reason your file is not being uploaded.See here:
http://php.net/manual/en/features.file-upload.post-method.php