Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Convert CSV to XML with PHP - When the data.csv is outside from the folder xml file is empty  RSS feed

Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Ranch Hand
Posts: 717
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Using it would be closer to a solution.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!