Hi,

Thanks, thats what I was thinking... he is what I have atm:

my $uploaddir = $CFG->{build_static_path} . '/ajax_upload/tmp_uplo +ads'; use Links::Plugins; my $PCFG = Links::Plugins::get_plugin_user_cfg ('ImageUpload'); my $maxFileSize = $PCFG->{max_file_size} * 1024 * 1024; # 1/2mb +max file size... my $num_max_files = $PCFG->{MaxNumberImages}; my $image_field = $PCFG->{ImageField}; use CGI; my $cgi = new CGI; my $queueID = $cgi->param('queueID'); use Data::Dumper; print $IN->header; # Where the data gets passed too... my $handle = $cgi->param('Filedata'); my $temp_id = $cgi->param('temp_id'); my $filename = $cgi->param('Filename'); my $file = $cgi->param('Filedata'); my $count = $DB->table("AJAXFileUploads")->count( { temp_id => $te +mp_id } ) || 0; # print "TempID : $temp_id "; if ($DB->table("AJAXFileUploads")->count( { temp_id => $temp_id, u +pload_filename => $filename } ) > 0) { print $IN->header; print qq|This file already seems to have been uploaded...|; exit; } print STDERR qq|$count > $num_max_files \n|; if ($count >= $num_max_files) { print $IN->header; print qq|Sorry, you can only upload $num_max_files ...|; exit; } print STDERR "Filename: $filename \n"; print STDERR "Temp ID: $temp_id \n"; print STDERR "Filename 1: $filename \n"; my $test = $filename =~ tr{&[]ÀÂÄàâäÇçÉÊÈËéêèëÏÌÎïìîÖÔÒöôòÜÛÙüûù?! +;«»()" íóñÑáéóúÁÉÍÓÚ}{___aaaaaacceeeeeeeeiiiiiioooooouuuuuu_________i +onnaeouaeiou}; print STDERR "FOO REPLACE: $test \n"; print STDERR "Filename 2: $filename \n"; my $count = $DB->table("AJAXFileUploads")->count( { temp_id => $te +mp_id } ) || 0; if ($DB->table("AJAXFileUploads")->count( { temp_id => $temp_id, u +pload_filename => $filename } ) > 0) { print $IN->header; print qq|This file already seems to have been uploaded...|; exit; } print STDERR qq|$count > $num_max_files \n|; if ($count >= $num_max_files) { print $IN->header; print qq|Sorry, you can only upload $num_max_files ...|; exit; } my @tmp = split /\./, $filename; if ($tmp[$#tmp] !~ /docx?|ppt|pps|pptx|ppsx|pdf/i) { print qq|Invalid file type...|; print STDERR "file has been NOT been uploaded... \n"; exit; } print STDERR "Making dir: $uploaddir/$temp_id \n"; mkdir("$uploaddir/$temp_id"); open(WRITEIT, ">$uploaddir/$temp_id/$filename") or die "Cant write + to $uploaddir/$filename. Reason: $!"; while (<$handle>) { print WRITEIT $_; } close(WRITEIT); my $check_size = -s "$uploaddir/$temp_id/$filename"; print STDERR qq|Main filesize: $check_size Max Filesize: $maxFile +Size \n\n|; if ($check_size < 1) { print $IN->header(); print STDERR "ooops, its empty - gonna get rid of it!\n"; print qq|File is empty...|; print STDERR "file has been NOT been uploaded... \n"; } elsif ($check_size > $maxFileSize) { print $IN->header(); print STDERR "ooops, its too large - gonna get rid of it!\n"; print qq|File is too large...|; print STDERR "file has been NOT been uploaded... \n"; } else { print $IN->header(); print "1"; print STDERR "file has been successfully uploaded... thank you +.\n"; $DB->table("AJAXFileUploads")->add( { temp_id => $temp_id, upload_filename => $filename, timestamp => time(), rand_id => $queueID } ) || die $GT::SQL::error; }
Not too sure what you mean by upgrading/degrading?

TIA!

Andy

In reply to Re^2: tr{}{} doesn't wanna work.. what am I doing wrong? by ultranerds
in thread tr{}{} doesn't wanna work.. what am I doing wrong? by ultranerds

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.