Forums
This topic is locked
PHP Upload 2? (Tim Green)
28 Feb 2002 17:32:26 Peter R posted:
Hey Tim,Just curious if the new version of PHP Upload is anywhere near being released? I need a good upload script that will insert images into blob fields. The script I use now is hardly "hacker resistant" which is why I only use it in my admin area.
Now I need a safe upload(to blob) script that I can allow the general public to use.
So, just thought I'd check in since I remember you saying you were working on a new one.
Thanks for your time Tim,
Peter
Replies
Replied 01 Mar 2002 21:10:20
01 Mar 2002 21:10:20 Bruno Mairlot replied:
Just out of curiosity,
why do you want to store your picture in a blob field ?
Bruno
--- Better to die trying, than never try at all ---
why do you want to store your picture in a blob field ?
Bruno
--- Better to die trying, than never try at all ---
Replied 02 Mar 2002 02:47:02
02 Mar 2002 02:47:02 Peter R replied:
Hi Bruno,
The reason I want to store them in blobs is because the portion of my site I'm building now is for clients to use with minimum assistance from myself. It's an auto sales, and realestate based section. Where my clients can add and delete cars... or houses. So since they won't know how to delete images off the server, I instead want the images deleted when they delete the record it belongs to.
Peter
The reason I want to store them in blobs is because the portion of my site I'm building now is for clients to use with minimum assistance from myself. It's an auto sales, and realestate based section. Where my clients can add and delete cars... or houses. So since they won't know how to delete images off the server, I instead want the images deleted when they delete the record it belongs to.
Peter
Replied 02 Mar 2002 23:10:04
02 Mar 2002 23:10:04 Bruno Mairlot replied:
Actually, I doesn't know anything about the advancement of the PHP 2 Upload.
I can, give a little trick to do that.
If you observe PHP Upload script, you'll see that it replace the field name (for example $photo) with the name of the uploaded file. So the normal Insert (or Update) works without knowing that the value of $photo has been changed.
What I suggest to you, is to insert a piece of code between the PHP Upload and the Insert behavior that will do the same. I mean replacing the value of $photo by the whole content of the picture instead of just its path.
To do that, you just have to read the file. The name of the file is contained in the $photo value.
Open the file, read its content, then save it into the $photo value.
In the Insert behavior, the query will be constructed with the whole content.
Though, this is a way to solve your problem, I don't recommend using it, because, there is no real need of it.
Actually, you'd better insert the path of the picture into your database, and when the user delete a row from the table, then make sure you delete the file as well.
You're going into much less trouble by using this method.
But of course, if you ABSOLUTELY have to insert it into the database, then go for it <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Bruno
--- Better to die trying, than never try at all ---
I can, give a little trick to do that.
If you observe PHP Upload script, you'll see that it replace the field name (for example $photo) with the name of the uploaded file. So the normal Insert (or Update) works without knowing that the value of $photo has been changed.
What I suggest to you, is to insert a piece of code between the PHP Upload and the Insert behavior that will do the same. I mean replacing the value of $photo by the whole content of the picture instead of just its path.
To do that, you just have to read the file. The name of the file is contained in the $photo value.
Open the file, read its content, then save it into the $photo value.
In the Insert behavior, the query will be constructed with the whole content.
Though, this is a way to solve your problem, I don't recommend using it, because, there is no real need of it.
Actually, you'd better insert the path of the picture into your database, and when the user delete a row from the table, then make sure you delete the file as well.
You're going into much less trouble by using this method.
But of course, if you ABSOLUTELY have to insert it into the database, then go for it <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Bruno
--- Better to die trying, than never try at all ---
Replied 03 Mar 2002 03:00:03
03 Mar 2002 03:00:03 Tim Green replied:
For the record, PHP Upload 2 isn't going to be released for a little while yet. I am at this moment concentrating on IntelliCART, and a couple of other projects after that to complete before I get to it.
Sorry if it isn't what you wanted to hear.
All the best
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>
Edited by - rawveg on 03 Mar 2002 03:00:31
Sorry if it isn't what you wanted to hear.
All the best
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>
Edited by - rawveg on 03 Mar 2002 03:00:31