I'm using json to open the user popup.
I used to use basename( $_FILES['userfile']['name'] )
on php, how to do that on perl?
Server side code:
#!/usr/bin/perl
use CGI;
print "Content-type: text/html;
Cache-Control: no-cache;
charset=utf-8\n\n";
@allowedExtensions =("jpg","tiff","gif","eps","jpeg","png");
my $q = CGI->new();
my $filename = $q->upload('userfile');
print "file name is $file_name";
Client side code:
var post_obj = new Object();
new AjaxUpload('upload_attachment_button', {
action: 'upload.cgi',
type: "POST",
data: post_obj,
onChange: function() {},
onSubmit: function() {
$("#upload_attachment_button").addClass('ui-state-disabled');
$("#upload_proj_message").html('<span> class="loading">uploading...</span>');
},
onComplete: function(file, response) {
$("#upload_attachment_button").removeClass('ui-state-disabled');
alert(response);
}
});