Saving to local machine HOW?
Posted 12 July 2006 - 01:43 AM
This appears to be simple but I am stumped. I have searched through all the past post but to no avail. Basically:
1. User clicks on a link and a php page is presented.
2. User selects a local TEXT CSV file and clicks on the 'Upload File' button.
3. Local file is sent to the web browser, where each line in the CSV file is read, processed, geocoded.
4. A HTML table is formed to display the results of the geo coding.
Everything works until this step.
5. The user needs to now click on a button, type in the name for the output file (just the name ....)
and the code should use the old directory path, append the output file name (as entered above), append the extension ".csv", open the file, write to it and close the file.
I know all about fopen, fwrite and fclose. My specific questions are:
1. How do I parse and retain the directory path of the original csv file so that I can save back to the same dir? $_FILES['userfile']['name'] does not have the dir path.
2. In the php file which displays the result, how do I create another button that will enabe the user to traverse the local file system pick another location and type in the file name for the output?
3. Lastly, since the results are displayed in the browser, the data has already been sent to the browser. If I save the results in an array in the php that processes the input, after the user clicks on this button, is the array available to me to then traverse and fwrite to the file?
I guess fundamnetally I don't understand where the data resides since I don;t want it to go back to the web server just to save the ouput to a local file.
Any help will be much appreciated!!!!
Posted 12 July 2006 - 02:36 AM
Posted 12 July 2006 - 04:04 AM
To explain better, the current process is:
1. getfile.php: Gets the original input file by using a form and a submit button, calls processfile.php
2. File gets uploaded to web server successfully, invokes processfile.php which
--moves the uploaded file,
--process each record
--Forms a table to display results in html
--and creates two ouput files in the web server one with .xml and one with .csv extension
3. I put the force download snippet of code before the html display in this php.
But I don't see the results on the screen. When I click on the 'Submit' button in the getfile.php, it waits (processing ...) and then the pop-up window to save the first xml file comes up. File is saved successfully, but .......
1. The second csv file is not downloaded.
2. The html display does not show up now. Why and how to fix it?
Thanks again for all the wonderful people out there.....This is one site that I am definitely going to contribute to.
Posted 12 July 2006 - 07:40 AM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users