XUpload - How to set and get POST Parameters.

XUpload related questions

Moderator: admin

Message
Author
webxmedia
Posts: 2
Joined: Aug 25, 2006 6:48 pm

How to set and get POST Parameters.

#1 Postby webxmedia » Aug 25, 2006 6:57 pm

HI I'm using XUpload Pro 2.x to upload gallery pictures, but also in the same form users enter in address details, account details etc. Trouble is I don't know how to send these additional form fieds once XUpload is submitted, because they don't appear to be posted by default. Does anyone know how to set POST variables in XUpload?

I'm using the following code to retrieve the vars in php, but of course it only gets what has been posted. How can I add additional fields to the posted form data?

$PARAM
= array_merge($_GET, $_POST);

$s = $PARAM['s']; # a scalar
$m = $PARAM['m']; # an array

$param_names = array_keys($PARAM);
$param_values = array_values($PARAM);
$num_params = count($PARAM);

for ($x=0; $x<$num_params; $x++) {
echo $param_names[$x]." : ".$param_values[$x]."<br />";
}

Really appreciate any sound advice. Thanks in anticipation.

admin
Site Admin
Posts: 1800
Joined: Mar 22, 2006 12:32 pm

Re: How to set and get POST Parameters.

#2 Postby admin » Aug 28, 2006 8:17 am

webxmedia wrote:HI I'm using XUpload Pro 2.x to upload gallery pictures, but also in the same form users enter in address details, account details etc. Trouble is I don't know how to send these additional form fieds once XUpload is submitted, because they don't appear to be posted by default. Does anyone know how to set POST variables in XUpload?

I'm using the following code to retrieve the vars in php, but of course it only gets what has been posted. How can I add additional fields to the posted form data?


All additional fields will be posted "as is" to "url_post" URL specified in XUploadConfig.pm.
So, for example you have "address" text input in your form.

Then in your PHP script, you should refer to it as:

$address = $_POST['address'];

As we said, XUpload is absolutely transperent.

Let me know if you will have any problems.

Thanks

Usagi
Posts: 5
Joined: Aug 28, 2006 1:59 pm

?url_post ?

#3 Postby Usagi » Aug 28, 2006 3:40 pm

All additional fields will be posted "as is" to "url_post" URL specified in XUploadConfig.pm.


I do not find "url_post" anywhere in XuploadConfig.pm.


My XuploadConfig.pm:

package XUploadConfig;

BEGIN
{
use Exporter;
@XUploadConfig::ISA = qw( Exporter );
@XUploadConfig::EXPORT = qw( $c );
}

our $c=
{
# Directory for temporary using files
temp_dir => '/home/mysite/cgi-bin/xupload/temp',

# Directory for uploaded files
target_dir => '/home/mysite/cgi-bin/xupload/uploads',

# Path to the template using for upload status window
templates_dir => '/home/mysite/cgi-bin/xupload/Templates',

# Allowed file extensions delimited with '|'
ext_allowed => 'jpg|jpeg|gif|png|rar|zip|mp3|avi|txt|csv',

# The link to redirect after complete upload
# This setting can be submitted from HTML form, then it will have priority
redirect_link => 'http://mysite.com/image_upload.php',

# Max length of uploaded filenames(without ext). Longer filenames will be cuted.
max_name_length => 64,

# Type of behavior when uploaded file already exist on disc. Available 3 modes: Rewrite/Rename/Warn
copy_mode => 'Rename',

# Maximum total upload size in Kbytes
max_upload_size => 700000000,

# Time to keep temp upload files on server, sec (24 hours = 86400 seconds)
temp_files_lifetime => 86400,

# CSS names
styles => { 'black' => 'black.css',
'hitech' => 'hi_tech.css',
'aqua' => 'aqua.css',
'tiny' => 'tiny.css',
'contrast'=> 'contrast.css',
},

# Template names
templates => { 'simple' => 'simple.html',
'hitech' => 'hitech.html',
'nice' => 'nice.html',
},
};

1;

admin
Site Admin
Posts: 1800
Joined: Mar 22, 2006 12:32 pm

Re: ?url_post ?

#4 Postby admin » Aug 29, 2006 8:25 am

Usagi wrote:
All additional fields will be posted "as is" to "url_post" URL specified in XUploadConfig.pm.


I do not find "url_post" anywhere in XuploadConfig.pm.


If you can't find post url - then you're using XUpload Free, not XUpload Pro.

webxmedia
Posts: 2
Joined: Aug 25, 2006 6:48 pm

POST data in PHP not displaying all variables.

#5 Postby webxmedia » Sep 03, 2006 9:37 pm

[I'm using the pro version code]

I'm having problems accessing all the post variables when I submit more than 1 file using any of the html_forms. I only seem to be able to view the data for one of the attached files even though you can clearly see from the sample below that 2 files were successfully attached and processed. The post url is a php file.

When I use the supplied perl post file it works but I have no perl experience and really need this to work in php. Would appreciate any advice as I've tried every way I know to extract the post data but every time I just get the data for 1 of the attached files.

file1x : image5.jpg
file1x_original : image.jpg
file1x_status : renamed
file1x_size : 91299
ext_folder :
email_notification :
target_dir : uploads
number_of_files : 2

admin
Site Admin
Posts: 1800
Joined: Mar 22, 2006 12:32 pm

Re: POST data in PHP not displaying all variables.

#6 Postby admin » Sep 05, 2006 5:53 am

webxmedia wrote:[I'm using the pro version code]

I'm having problems accessing all the post variables when I submit more than 1 file using any of the html_forms. I only seem to be able to view the data for one of the attached files even though you can clearly see from the sample below that 2 files were successfully attached and processed. The post url is a php file.

When I use the supplied perl post file it works but I have no perl experience and really need this to work in php. Would appreciate any advice as I've tried every way I know to extract the post data but every time I just get the data for 1 of the attached files.


Hello,

please email us ([email protected]) link to your upload form and give us FTP connection info if possible. We will take a look at your installation.

Thanks.

Manfred Kooistra
Posts: 4
Joined: Jan 02, 2007 1:20 am

Re: ?url_post ?

#7 Postby Manfred Kooistra » Jan 02, 2007 1:30 am

By now I am working with XUpload Pro, but with the Free version I had the same problem that webxmedia and Usagi have had: the POST data is not passed on to the PHP script defined as the redirect_link in XUploadConfig.pm.

admin wrote:
Usagi wrote:
All additional fields will be posted "as is" to "url_post" URL specified in XUploadConfig.pm.


I do not find "url_post" anywhere in XuploadConfig.pm.


If you can't find post url - then you're using XUpload Free, not XUpload Pro.


In the features list at http://www.sibsoft.net/xupload.html#features you claim that even XUpload Free will pass on the POST data.

How?

Or maybe you should change the features list ...

User avatar
PilgrimX182
Posts: 2182
Joined: Mar 22, 2006 1:39 pm
Location: UFO Lab
Contact:

#8 Postby PilgrimX182 » Jan 11, 2007 6:34 am

Both XUpload FREE & Pro do have url_post parameter. Probably you used redirect_link and removed url_post from config.
Using redirect_link parameter you can not send POST data, only redirect.

Manfred Kooistra
Posts: 4
Joined: Jan 02, 2007 1:20 am

#9 Postby Manfred Kooistra » Jan 11, 2007 11:37 pm

admin wrote:If you can't find post url - then you're using XUpload Free, not XUpload Pro.


I take that to mean that there is no post url in XUpload Free.

PilgrimX182 wrote:Both XUpload FREE & Pro do have url_post parameter.


I just downloaded XUpload Free again and opened XUploadConfig.pm. Here it is:

Code: Select all

package XUploadConfig;

BEGIN
{
  use Exporter;
  @XUploadConfig::ISA = qw( Exporter );
  @XUploadConfig::EXPORT = qw( $c );
}

our $c=
{
 # Directory for temporary using files
 temp_dir        => '/.../temp',

 # Directory for uploaded files
 target_dir      => '/.../uploads',

 # Path to the template using for upload status window
 templates_dir   => '/.../Templates',

 # Allowed file extensions delimited with '|'
 ext_allowed     => 'jpg|jpeg|gif|png|rar|zip|mp3|avi|txt|csv',

 # The link to redirect after complete upload
 # This setting can be submitted from HTML form, then it will have priority
 redirect_link   => 'http://YOUR-SERVER/.../upload_form.html',

 # Max length of uploaded filenames(without ext). Longer filenames will be cuted.
 max_name_length => 64,

 # Type of behavior when uploaded file already exist on disc. Available 3 modes: Rewrite/Rename/Warn
 copy_mode       => 'Rename',

 # Maximum total upload size in Kbytes
 max_upload_size => 700000000,     

 # Time to keep temp upload files on server, sec (24 hours = 86400 seconds)
 temp_files_lifetime => 86400,

 # CSS names
 styles          => { 'black'   => 'black.css',
               'hitech'  => 'hi_tech.css',
               'aqua'    => 'aqua.css',
               'tiny'    => 'tiny.css',
                              'contrast'=> 'contrast.css',
             },

 # Template names
 templates => { 'simple' => 'simple.html',
                'hitech' => 'hitech.html',
           'nice'   => 'nice.html',
         },
};

1;


Maybe I'm blind, but I truly can't find url_post in there.

PilgrimX182 wrote:Probably you used redirect_link and removed url_post from config.


No, I did not remove anything. I downloaded and opened the files and searched. Please let me know in which line of what file of XUpload Free you see url_post.

Or do you mean that I should put it in ?!?

User avatar
PilgrimX182
Posts: 2182
Joined: Mar 22, 2006 1:39 pm
Location: UFO Lab
Contact:

#10 Postby PilgrimX182 » Jan 12, 2007 8:04 am

Well...you're right...partially. There's no url_post inside free config. It's like a bit hidden feature :)

In free version you can use 2 ways of defining url_post parameter: using hidden input in html page or using parameter in config, both named 'url_post'.

Just add it manually.

PS: good news 4 u - you're not blind :)


Return to “XUpload”

Who is online

Users browsing this forum: No registered users and 0 guests