XUpload - Xupload Free Edition, File uploads, no progress.

Message
Author
Mahdii
Posts: 2
Joined: Jan 23, 2008 9:21 pm

Xupload Free Edition, File uploads, no progress.

#1 Postby Mahdii » Jan 23, 2008 9:28 pm

The file is going to the proper directory, and the page posts properly.. But - no progress bar!

http://mysite.com/cgi-bin/post.cgi reads:

Code: Select all

target_dir:/var/www/vhosts/mysite.com/httpdocs/test/xup/cgi-bin/uploads/
This is where the files go.


XUploadConfig.pm

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        => '/var/www/vhosts/mysite.com/cgi-bin/temp/',

 # Directory for uploaded files
 target_dir      => '/var/www/vhosts/mysite.com/httpdocs/test/xup/cgi-bin/uploads/',

 # Path to the template using for upload status window
 templates_dir   => '/var/www/vhosts/mysite.com/httpdocs/test/xup/cgi-bin/Templates',

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

 # URL to send all input values from upload page
 url_post        => 'http://mysite.com/cgi-bin/post.cgi',

 # 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/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 => 70000000,

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

};

1;
HTML

Code: Select all

<HTML>
<HEAD>
<Title>XUpload - upload progress bar</Title>

<Style>
body {background-color: #f9f9f9; font: 13px Arial;}
</Style>

<Script language="JavaScript">

var exts = "jpg|gif|png|bmp|mp3|mpg|mpeg|avi|rar|zip|7z|gz|txt";
//var exts = ".*"; //Use this to accept all Extensions

var UID,NF=0,cx=0;
function openStatusWindow()
{ 
 if(document.F1.popup.checked == true)
 {
   win1 = window.open('../../cgi-bin/upload_status.cgi?upload_id='+UID,'win1','width=320,height=240,resizable=1');
   win1.window.focus();
 }
}

function generateSID()
{
 UID = Math.round(10000*Math.random())+'0'+Math.round(10000*Math.random());
 var f1=document.F1;
 f1.action = f1.action.split('?')[0]+'?upload_id='+UID;
}

function StartUpload()
{
    NF=0;
    for (var i=0;i<document.F1.length;i++)
    {
     current = document.F1.elements[i];
     if(current.type=='file' && current.value!='')
      {
         if(!checkExt(current.value))return false;
         NF++;
      }
    }
    if(NF==0){alert('Select at least one file to upload');return false;};
    generateSID();
    openStatusWindow();
}

function checkExt(value)
{
    if(value=="")return true;
    var re = new RegExp("^.+\.("+exts+")$","i");
    if(!re.test(value))
    {
        alert("Extension not allowed for file: \"" + value + "\"\nOnly these extensions are allowed: "+exts.replace(/\|/g,',')+" \n\n");
        return false;
    }
    return true;
}

</Script>
</HEAD>
<BODY>
<center>
<h2>XUpload demo page</h2>
<form name="F1" enctype="multipart/form-data" action="../../cgi-bin/upload.cgi?upload_id=" method="post" onSubmit="return StartUpload();" target="upload">
Send file: <input name="file1x" type="file" onChange="checkExt(this.value)"><br>
Comment: <input type="text" name="comment">(optional)
<br><br>
<Input type="checkbox" name="popup" checked id="popup"><label FOR="popup" ACCESSKEY="Z">Show upload status in pop-up window</label><br>
<br>
<input type="submit" value="Upload File">
</form>
<br><br>

<iframe src="about:blank" name="upload" frameborder=0 style="width: 0px; height: 0px;"></iframe>
<a href="http://www.sibsoft.net/xupload.html" style="font: 12px Arial; color: #7979b3;">SibSoft XUpload - upload progress bar</a>
</center>
</BODY>
</HTML>

Permissions set proper, no errors returned. Just a blank pop-up with no progress bar! Well blank until the upload finishes.. Then:

"Transfer complete!


- Close -"

And page redirect with post-data.

Mahdii
Posts: 2
Joined: Jan 23, 2008 9:21 pm

#2 Postby Mahdii » Jan 23, 2008 10:09 pm

For anyone as stupid as me :)

Code: Select all

# Path to the template using for upload status window
 templates_dir   => '/var/www/vhosts/mysite.com/httpdocs/test/xup/cgi-bin/Templates', 
Should be:

Code: Select all

# Path to the template using for upload status window
 templates_dir   => '/var/www/vhosts/mysite.com/httpdocs/test/xup/cgi-bin/Templates/',