In the free version it was possible to add the url_post value to the form.
In the pro version the url_post value can be set in the settings file.
Is it possible to use/ set the url_post value in the uploading form.
My url_post value is dynamically!
Greetings
Michel
XUpload - url_post
- PilgrimX182
- Posts: 2186
- Joined: Mar 22, 2006 1:39 pm
Nopes. This was disabled in Pro due to security issues.
But you can make a quick hack in upload.cgi :
replace
with
and then specify url_post in upload form.
But you can make a quick hack in upload.cgi :
replace
Code: Select all
my $url_post = $c->{url_post} || $ENV{HTTP_REFERER};
Code: Select all
my $url_post = $cg->param('url_post') || $c->{url_post} || $ENV{HTTP_REFERER};
It will work when redirect to an URL.
But when it has to be redirected to an address like this:
http://www.test.nl/cgi-bin/test.cgi?act ... ing&test=1
the part after the ? will be ignored!! It will redirect to:
http://www.test.nl/cgi-bin/test.cgi. How to fix that??
But when it has to be redirected to an address like this:
http://www.test.nl/cgi-bin/test.cgi?act ... ing&test=1
the part after the ? will be ignored!! It will redirect to:
http://www.test.nl/cgi-bin/test.cgi. How to fix that??
- PilgrimX182
- Posts: 2186
- Joined: Mar 22, 2006 1:39 pm
It's cause we send POST request there. And "?action=do_something&test=1" is GET request.
As far as I know in PHP you can read them in POST and GET arrays, in Perl you can use CGI.pm function url_param
Details are here:
http://search.cpan.org/~lds/CGI.pm-3.29 ... PARAMETERS
As far as I know in PHP you can read them in POST and GET arrays, in Perl you can use CGI.pm function url_param
Details are here:
http://search.cpan.org/~lds/CGI.pm-3.29 ... PARAMETERS
I have changed:
to the following:
and it worked! Thanks again!
Code: Select all
### Sending data with POST request if need
my $url_post = $c->{url_post} || $ENV{HTTP_REFERER};
if($url_post)
{
if($url_post=~/\.htm(l|)$/i)
{
print"Content-type: text/html\n\n";
print"<HTML><HEAD><Script>parent.document.location='$url_post'</Script></HEAD></HTML>";
exit;
}
if($ENV{QUERY_STRING}!~/js_on=1/)
{
$url_post.='?';
$url_post.="\&$_->{name}=$_->{value}" for @har;
print $cg->redirect( $url_post );
exit;
}
print"Content-type: text/html\n\n";
print"<HTML><BODY><Form name='F1' action='$url_post' target='_parent' method='POST'>";
print"<textarea name='$_->{name}'>$_->{value}</textarea>" for @har;
# print"</Form><Script>document.F1.submit();document.location='about:blank';</Script></BODY></HTML>";
print"</Form><Script>document.location='javascript:false';document.F1.submit();</Script></BODY></HTML>";
exit;
}
Code: Select all
### Sending data with POST request if need
my %form_url_post;
my $form_url_post;
if ($cg->param('url_post')) {
$form_url_post = (split(/\?/,$cg->param('url_post')))[-1];
my @form_url_post = split(/\&/,$form_url_post);
foreach (@form_url_post) {
my ($key,$value) = split /\=/;
$form_url_post{$key} = $value;
}
}
my $url_post = $cg->param('url_post') || $c->{url_post} || $ENV{HTTP_REFERER};
if($url_post)
{
if($url_post=~/\.htm(l|)$/i)
{
print"Content-type: text/html\n\n";
print"<HTML><HEAD><Script>parent.document.location='$url_post'</Script></HEAD></HTML>";
exit;
}
if($ENV{QUERY_STRING}!~/js_on=1/)
{
$url_post.='?';
$url_post.=$form_url_post if ($form_url_post);
$url_post.="\&$_->{name}=$_->{value}" for @har;
print $cg->redirect( $url_post );
exit;
}
print"Content-type: text/html\n\n";
print"<HTML><BODY><Form name='F1' action='$url_post' target='_parent' method='POST'>";
if($cg->param('url_post'))
{
print"<input type='hidden' name='$_' value='$form_url_post{$_}' />" foreach (keys %form_url_post);
}
print"<textarea name='$_->{name}'>$_->{value}</textarea>" for @har;
# print"</Form><Script>document.F1.submit();document.location='about:blank';</Script></BODY></HTML>";
print"</Form><Script>document.location='javascript:false';document.F1.submit();</Script></BODY></HTML>";
exit;
}