When I moved the 'data.csv' to other place location it will not save the 'xml-import.xml' on my computer. The code only works if the CSV file 'data.csv' is in the same folder with convert.php (name of my PHP script) but if you moved the data.csv to different location, the 'xml-import.xml' are not save.
All I need is even if you move the data.csv files from different location the 'xml-import.xml' also save. Is that possible?
If it is a file upload php script, the file name that is loaded would not be captured by $_POST['fname'] but would be hidden in $_FILES. Maybe it is after all not a file upload script, but a script allowing the client to give instruction to transform the csv to an xml. In any case, you said it works in some condition, I take your words for it.
If this is the line where you intend to set up for the case where the uploaded csv file is at some other (sub-directory), this is certainly not to work. You cannot even to take profit from the interpolation using double-quote as such without further twist for the purpose, as for $value.