XUpload - xmode does not function

Message
Author
claude
Posts: 3
Joined: Jul 25, 2009 6:34 am

xmode does not function

#1 Postby claude » Aug 11, 2009 11:48 am

I have a form passing this variable:

Code: Select all

<input type="hidden" name="xmode" id="xmode" value="2">
<input type="hidden" name="pbmode" id="pbmode" value="2">
In the file XUPLOADCONFIG.pm i have the settings

Code: Select all

modes =>
 {
   1 =>
   {
      # Directory for uploaded files
      target_dir      => '/home/www/web2/html/uploads/',
     
      # URL to send all input values from upload page
      #url_post        => 'http://sds:8071/cgi-bin/UPLOAD2/post2.cgi',
      url_post        => 'http://www.abc.net/uploader/post.php',
     
      # Max number of upload fields
      max_upload_files => 5,
     
      # Minimum/Maximum Total upload size limit in MBytes (empty or zero to disable)
      min_upload_size => 0,
      max_upload_size => 500,

      # Minimum/Maximum upload Filesize limit in Mbytes (empty or zero to disable)
      min_upload_filesize => 0,
      max_upload_filesize => 20,
     
      # Allowed file extensions delimited with '|'
      # Use '.*' to allow all extensions
      #ext_allowed     => 'jpg|jpeg',
      ext_allowed     => '.*',

      # Not Allowed file extensions delimited with '|'
      # Leave it blank to disable this filter
      ext_not_allowed => '',
   },
   2 =>
   {
      target_dir      => '/home/www/web1/html/intern/fiches/',
      url_post        => 'http://www.dfg.net/fiches/post.php',
      max_upload_files => 5,
      min_upload_size => 0,
      max_upload_size => 500,
      min_upload_filesize => 0,
      max_upload_filesize => 20,
      ext_allowed     => '.*',
      ext_not_allowed => '',
   },
 },
But everytime files are uploaded in the folder specified in mode number 1 and i ma redirected to post file specified in mode number 1.

No settings of mode number 2 are being considered (nor for upload nor for post-redirect)

whats wrong?

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

#2 Postby PilgrimX182 » Aug 11, 2009 11:56 am

What XUpload version?
In latest 3.1 mode setting via JavaScript like this:

Code: Select all

<Script>
var x_mode = 1;
</Script>
check default sample.

yixiazi
Posts: 2
Joined: Dec 03, 2009 5:24 pm

#3 Postby yixiazi » Dec 03, 2009 5:29 pm

In the documentation above the mode settings in my XUploadConfig.pm it says:

# You can use different upload modes for different upload forms
# Specify upload mode in xmode hidden input in upload_form.html
I have done this and it continues to use the default cgi-bin/uploads directory even though in my XUploadConfig.pm I have specified it to use another folder.

target_dir => '[my root path here]/uploads/files/transfer',

How do I remedy this?

yixiazi
Posts: 2
Joined: Dec 03, 2009 5:24 pm

#4 Postby yixiazi » Dec 03, 2009 5:33 pm

This does not work:

<input type="hidden" name="x_mode" id="x_mode" value="1">

This does not work either:


<input type="hidden" name="xmode" id="xmode" value="1">

As a further note I specified the following in the javascript file

Code: Select all

if(!window.x_mode)x_mode=1;

/* 
After the above statement I tried the one below as a test 
*/

x_mode=2;
That did not work either. As a matter of fact, in both mode 1 settings and mode 2 settings I have specified directiories other than the cgi-bin/uploads folder, but to no avail. This means to my mind that the cgi-bin/uploads/ folder is hard-coded in somewhere that is causing the script to completely ignore the XUploadConfig.pm target_dir array variable.

I know this because when I do switch modes in the javascript it responds by using my ext_allowed settings. This lets me know the script has stepped into the right mode, yet ignores my different upload directory settings just the same.

sffc
Posts: 1
Joined: Aug 16, 2010 9:13 am

#5 Postby sffc » Aug 16, 2010 9:26 am

Sorry to bump an old topic, but I was having this problem too, and I found a fix. In upload_form_tiny.html, where it says:

Code: Select all

<script type="text/javascript">
var x_form_id = 'myform';
</script>
Put:

Code: Select all

<script type="text/javascript">
var x_form_id = 'myform';
var x_mode = 3;
</script>
It actually mentions this in INSTALL.txt. Worked fine for me after this change.

I think yixiazi was missing the "var" keyword.