Forums
This topic is locked
tried all the solutions, but it will not work
Posted 28 Dec 2001 15:11:18
1
has voted
28 Dec 2001 15:11:18 marc mueller posted:
<font face='Arial'></font id='Arial'>hi folks
I'd like to insert the filename from a fileupload into a database field (submit at the same time). I use the php file upload and the php insert record. My problem is, that the variable (example $file_name) is empty when the insert proceeds. After I do the next file I get the old filname in the database. I use PHakt and a MySQL Server.
I've already read all the postings, but none of the solutions semms to work. I'm glad, if someone could help me.
regards
Marc Müller
mailto:
Edited by - muellernet on 28 Dec 2001 18:27:08
Replies
Replied 29 Dec 2001 13:29:33
29 Dec 2001 13:29:33 Tim Green replied:
Marc. The trick here I think is actually applying the behaviours in the right order, as this will affect the order in which the behaviours are processed.
Ensure that you first apply the PHP File Upload behaviour to the page (ensuring that you do not use any of the redirect elements within that behaviour), and then apply the insert record behaviour.
Another useful tip would be to add a hidden form field with the name element (eg $file_name) into the form. This will allow you to correctly map the right variable to the column in your table.
The value of this variable will be overwritten when the upload completes correctly.
Anyway, I hope this helps.
Tim Green
Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Ensure that you first apply the PHP File Upload behaviour to the page (ensuring that you do not use any of the redirect elements within that behaviour), and then apply the insert record behaviour.
Another useful tip would be to add a hidden form field with the name element (eg $file_name) into the form. This will allow you to correctly map the right variable to the column in your table.
The value of this variable will be overwritten when the upload completes correctly.
Anyway, I hope this helps.
Tim Green
Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Replied 30 Dec 2001 15:25:17
30 Dec 2001 15:25:17 marc mueller replied:
<font face='Arial'></font id='Arial'>
hi tim
The Tip with the order does not function in every case. But I found an other way to solve it:
- I made a new Server Behaviour with the following code: <?php $datei = $upload->new_file ?> and put it right after the upload code. So when the "submit" happens the variable ist empty, but right after the upload sequence the variable is filled with the result. Now when the insert record proceeds, the value is set.
Thanks a lot and a happy new year.
Marc
mailto:
hi tim
The Tip with the order does not function in every case. But I found an other way to solve it:
- I made a new Server Behaviour with the following code: <?php $datei = $upload->new_file ?> and put it right after the upload code. So when the "submit" happens the variable ist empty, but right after the upload sequence the variable is filled with the result. Now when the insert record proceeds, the value is set.
Thanks a lot and a happy new year.
Marc
mailto: