我正在使用 json 打开用户弹出窗口。我以前 basename( $_FILES['userfile']['name'] )
在php上使用,如何在perl上做到这一点?
服务器端代码:
#!/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";
客户端代码:
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);
}
});