Pure PHP Upload 2 Support Product Page

This topic was archived

dynamic folder ?

Asked 14 Jan 2005 17:32:32
1
has this question
14 Jan 2005 17:32:32 tom dood posted:
Hi

Is there a simple way to have images uploaded to a dynamic folder ?

I have a load of images which were originally saved at 3 or 4 different sizes but they have the same name. I need to convert this site to a dynamic now so need to direct different sized files to different folders.

Any ideas

Many thanks

Replies

Replied 01 Mar 2005 11:40:32
01 Mar 2005 11:40:32 Chris Charlton replied:
By default the PurePHP Upload extension interface doesn't have an easy way to associate dynamic folders for multiple images like you're asking. Well, not yet anyway. If you please, add your feature request in the extensions' forum.

Also, if you reply back with your knowledge level of PHP, we may be able to help you further.

~ ~ ~ ~ ~ ~ ~
Chris Charlton <i>- DMXzone Manager</i>
<font size=1>[ Studio MX/MX2004 | PHP/ASP | SQL | XHTML/CSS | XML | Actionscript | Web Accessibility | MX Extensibility ]</font id=size1>
Replied 29 Dec 2005 18:06:30
29 Dec 2005 18:06:30 Josh Byers replied:
I know this thread is old, but hopefully my answer will help people searching on this problem.

You can do this. It is referenced in the 16 tutorials off of the PHP Upload product page. You can place an expression in the file field in the upload extension to tell the file what folder to be placed in. For example I needed an image uploaded to go to one of 9 different folders. In the form I created a dropdown with the 9 options and then placed this expression in the folder field in the upload extension. "../ssp/albums/".$HTTP_POST_VARS['aid']."/lg"

This particular expression allows for the image to be placed dynamically in an existing folder path. The 'aid' is the name of the dropdown field. Just make sure that the values in the dropdown are the same as your folder names. If they are not it will create a new folder automatically which could be useful in certain circumstances. For those with little php experience the periods in the expression allow the concatonation of the path. So it would be possible to add in multiple expressions if you needed too.

Edited by - jayberz on 29 Dec 2005 18:07:57

Reply to this topic