XUpload - Multiple param files or dynamically pass parameters ?

loic d
Posts: 3
Joined: Aug 14, 2007 4:44 pm

Multiple param files or dynamically pass parameters ?

#1 Postby loic d » Aug 14, 2007 5:21 pm

Congratulations for your work, it's pretty awesome !

Let me drop a quick explanation first : My company is hosting several websites, dedicated to audiovisual archive managment.
Each site has specific directories, design, etc, though they share the same core (PHP libs, upload components, etc).

Obviously, the destination directory for uploads is different for every client. Moreover, we use the upload for different purposes for each client, ending in several configs and allowed file types (movies / documents / storyboard, etc).
And additionnally, our software is multilingual.

So I'd like to know :
1. If there is a possibility to specify dynamically one xUploadConfig file to use ?
2. If there is a possibility to put this config file elsewhere than in the cgi-bin (ie in the client specific directories for us) ?
3. Or if it is possible to pass dynamically the params found in the xUploadConfig (destination, file type, sizes, redirection) ?

I'm a pretty skilled PHP programmer, but I'm a ignorant in CGI/PERL, so I prefer to ask you first.

Thanks a lot !


User avatar
Posts: 2186
Joined: Mar 22, 2006 1:39 pm

#2 Postby PilgrimX182 » Aug 15, 2007 5:33 am

Thanks Loïc,

in XUpload Pro in config there is recent feature that allow to define several custom configs and only specify config ID in upload form hidden field. So you can use One same config file with some subconfigs inside. You can define custom upload folders, size limits, allowed filetypes, POST URL there.
I think this will work for you.


loic d
Posts: 3
Joined: Aug 14, 2007 4:44 pm

#3 Postby loic d » Aug 16, 2007 8:13 am


Yes, I saw the xmode parameter in both the forms and the config files, but this can't be a reliable solution for me.
Technically this could do the trick but in term of maintenance this could lead to many problems.
Multiply our upload types by our clients and by our supported languages and you've got a huge config file to manage where any mistake can have pretty hard consequences for us.
Moreover, we plan to let our new clients to automatically create accounts
and I don't see any solution here for the param file. :(

So, my question seems to end to a new feature request : ;)
- Have multiple config files, being located elsewhere than in the cgi-bin.
- Pass parameters dynamically (by POST for example, like you did with the destination directory).

To my opinion, the second one seems to be quite handy and inevitable in the future. :P

Regards and thanks for the quick reply and for the efforts you put in Xupload


loic d
Posts: 3
Joined: Aug 14, 2007 4:44 pm

#4 Postby loic d » Aug 16, 2007 3:33 pm

Next step of my adventures, might be useful for someone, who knows ? :

First, I've modified the script

Code: Select all

my $url_post = $c->{url_post} || $ENV{HTTP_REFERER} ;

Code: Select all

my $url_post = $c->{url_post} || $cg->param('url_post') || $ENV{HTTP_REFERER} ;
This allows to use a form field "url_post" to redirect after upload.

I didn't want to use the 'ext_folder' param to specify the destination, as I consider this to be quite unsecure.
BTW, to hide the destination dir also after redirection, I've removed the line

Code: Select all

push @har, { name=>'target_dir',      value=>$c->{target_dir}, 'style'=>2 };
At last, I've discovered in Apache the command

Code: Select all

AddHandler cgi-script .cgi
It allows cgi to be executed outside the regular cgi-bin directory provided you add the ExecCGI Option for every directory containing cgi scripts.
I've removed xUpload from our generic cgi-bin dir and put it in every website / subdomain we host.
As everything in xUpload uses relative path (BIG thanks !) it works flawlessly.
The little price to pay is the redundancy between script files but now, I have the specific solution I wanted. I can even change the look'n'feel for every client if asked.

I hope this could help someone a day...


Posts: 9
Joined: Feb 04, 2008 11:04 am

#5 Postby bugboy » Feb 04, 2008 5:11 pm

thats helped a awful lot cheers