Dynamic Upload Directory

Upload core product.
Post Reply
liquidreflex
Posts: 2
Joined: Mon Jan 19, 2009 8:55 pm

Dynamic Upload Directory

Post by liquidreflex »

Hello,

I hope I haven't missed where this was discussed, but I looked in the FAQ, the installation instructions, in the forums as well as in the documentation for the demo downloaded.

I am interested in integrating the FileUpload feature to my script but the nature of my script is that each "Client" logs in and can upload to their directory (or if they are an Admin, upload to a certain directory for the client). I can pass this directory / path via PHP in a dynamic variable, but I was not able to find where you set the upload directory?

Is there a setting for where the files are uploaded to? Is that hard-coded in and would need to be adjusted? Or is that something that can be added as a variable each time?

I really like the simplicity of the script and I think it would be a great addition to my project. If anyone can point me in the right direction, I would greatly appreciate it.

Thank you

Kevin

User avatar
support
Posts: 1503
Joined: Sun Jan 27, 2008 6:19 pm

Re: Dynamic Upload Directory

Post by support »

Yes, there are two solutions (see below) but you have to know that the upload folder root is setup in the upload script. If you look at our PHP sample you will see that at the top:
$upload_dir = "c:/uploads";

1 - Use "account" extra parameter such as:
<PARAM NAME="param5" VALUE="account">
<PARAM NAME="value5" VALUE="user1">
With our PHP script, it will upload the file into "c:/uploads/user1";
So you can generate the JavaScript in a PHP and pass the user's folder in account parameter.

2 - You can pass any custom parameter in the applet.
If you don't like solution 1 then you can pass your own parameter such as:
<PARAM NAME="param6" VALUE="myownparam">
<PARAM NAME="value6" VALUE="upload/user1">
Then you can get myownparam in the POST PHP array and do what you want with it.

Does it help ?

liquidreflex
Posts: 2
Joined: Mon Jan 19, 2009 8:55 pm

Re: Dynamic Upload Directory

Post by liquidreflex »

Yes, that definitely helps illustrate it better and I believe that should do exactly what I would need. Just need some way to put in a dynamic directory, and that "account" value should work just fine.

I'll do some testing with the download, but I think this may be a great addition to my script!

Thanks!

Post Reply