Hi,

I have a routine which reads a file using type='file'. I would like to be able to update the file and save it in the same location it came from, which would be in the C:\ directory. However, I cannot see how to get hold of the path associated with my file. Can anyone help with this?

Thanks, Dave.

Hi,

I have a routine which reads a file using type='file'. I would like to be able to update the file and save it in the same location it came from, which would be in the C:\ directory. However, I cannot see how to get hold of the path associated with my file. Can anyone help with this?

Thanks, Dave.

can you plz explain the problem more clearly..........with some snipet that you applied

Hi,

I have a routine which reads a file using type='file'. I would like to be able to update the file and save it in the same location it came from, which would be in the C:\ directory. However, I cannot see how to get hold of the path associated with my file. Can anyone help with this?

Thanks, Dave.

i think one solution for this is:
you just get the path you have to update in database and also in folder....
just use unlink to delete the file in that folder...
then simply use update query to update the path and use your regular code to insert the file in your folder...
hope this will helps you...

Shanti,

I don't understand your suggestion. Let me add more detail to the problem.
I am writing some code to automate sending emails for annual subscriptions to members of my running club. I do not use a database, as there is personal data which I do not want to reside on the server. The club secretary holds records on an excel spreadsheet, and saves as an .xml type file. This is then entered on a form into the program, as follows:

<form enctype="multipart/form-data" 
  action="member-list.php" method="post">
  <input type="hidden" name="MAX_FILE_SIZE" value="2000000" />
  <table width="600">
  <tr>
  <td>Names file:</td>
  <td><input type="file" name="memList" /></td>
  <td><input type="submit" value="Upload" /></td>
  </tr>
  </table>
</form>

Note that I do not know where the .xml file resides, it is somewhere on his c:\ drive.
I then access the file via a DOM:

$dom = DOMDocument::load( $_FILES['memList']['tmp_name'] );

and change a date field in one of the nodes in the dom. I am able to successfully save the updated file as follows, but ONLY if I know where the .xml file resides:

$dom->save('c:\\filepath\Members.xml');

As I have said, I do not know the filepath, and wish to know how to obtain that information.
The code

$_FILES['memList']['name'];

only gives me the file name (in this case Members.xml) but not the filepath.

Dave.

This article has been dead for over six months. Start a new discussion instead.