", T('This is the text you submitted:'), ... } }}} : 통채로 추가 {{{perl sub DoUpload { my $file; my $upload = &GetParam('upload'); my $prev_error = &GetParam('error', ""); my @uploadError = ( T('Upload completed successfully'), T('Invalid filename'), T('You can not upload html or any executable scripts'), T('File is too large'), T('File has no content'), ); my $result; print &GetHttpHeader(); print &GetHtmlHeader("$SiteName : ". T('Upload File'), ""); print $q->h2(T('Upload File')) . "\n"; if (!(&UserCanEdit("",1))) { print T('Uploading is not allowed'); print $q->end_html; return; } if ($prev_error) { print "$uploadError[$prev_error]\n"; } elsif ($upload) { $file = &GetParam('upload_file'); $result = &UploadFile($file); print "$uploadError[$result]\n"; } &PrintUploadFileForm(); print $q->end_html; } sub PrintUploadFileForm { print T('Select the file you want to upload') . "\n"; print "".Ts('File must be smaller than %s MB', ($MaxPost / 1024 / 1024)) . "\n"; print $q->start_form('post',"$ScriptName", 'multipart/form-data') . "\n"; print ""; print "" . "\n"; print "" . "\n"; print $q->filefield("upload_file","",60,80) . "\n"; print " " . "\n"; print $q->submit(T('Upload')) . "\n"; print "" . "\n"; print $q->endform(); } sub UploadFile { my ($file) = @_; my ($filename); my ($target); if ($file =~ m/\//) { $file =~ m/(.*)\/([^\/]*)/; $filename = $2; } elsif ($file =~ m/\\/) { $file =~ m/(.*)\\([^\\]*)/; $filename = $2; } else { $filename = $file; } if (($filename eq "") || ($filename =~ /\0/)) { return 1; } if ($filename =~ m/(\.pyc|\.py|\.pl|\.html|\.htm|\.php|\.cgi)$/i) { return 2; } $filename =~ s/ /_/g; my ($prefix, $target, $target_full) = (1, $filename, "$UploadDir/$filename"); while (-f "$target_full") { $prefix++; $target = "$prefix"."_$filename"; $target_full = "$UploadDir/$target"; } &CreateDir($UploadDir); open (FILE, ">$target_full") || die Ts('cant opening %s', $target_full) . ": $!"; binmode FILE; while (<$file>) { print FILE $_; } close(FILE); chmod(0644, "$target_full"); if ((-s "$target_full") > $MaxPost) { unlink "$target_full"; return 3; } if ((-s "$target_full") == 0) { unlink "$target_full"; return 4; } print T('Following is the Interlink of your file') . "\n"; print "\n"; print "Upload:$target\n"; print "\n"; return 0; } }}} : translations/korean.pl {{{perl Upload File 화일 업로드 Upload completed successfully 업로드가 성공적으로 끝났습니다 Invalid filename 화일 이름이 올바르지 않습니다 You can not upload html or any executable scripts html 또는 실행 스크립트는 올릴 수 없습니다 File is too large 화일이 너무 큽니다 File has no content 화일의 내용이 없습니다 Following is the Interlink of your file 다음 주소를 복사해서 사용하세요 Uploading is not allowed 업로드가 허용되지 않습니다 Select the file you want to upload 업로드할 화일을 선택하세요 File must be smaller than %s MB 화일 크기는 %s MB 이하여야 합니다. Upload 업로드 cant opening %s %s 를 열 수 없습니다 }}} == Notes == 도대체 왜 리눅스에서는 안 되는 걸까요? 화일명의 전체 경로가 제대로 넘어가지 않는 듯 합니다. :리눅스 뿐만이 아니라 윈도 피닉스, 그러니깐 모질라, 넷스까지 포함하게 되겠네요.. 저것들이 전부 제대로 업이 안되었습니다. 모질라는 주소전송시 UTF-8로 변환을 무조건 수행하는 거 같은데, 이것을 어떻게 해줘야 좋을지 몰라서 저는 그냥 이대로 쓰고 있습니다만.. IE에서도 저 옵션을 끄지않고 한글화일을 올리려하니 제대로 안되더군요. ㅜㅡ :: 유닉스 쪽에서는, 화일명을 전달할 때 전체 경로가 전달되는 게 아닌가 보더라고요. 그래서 기존의 if 문 (전체 경로에서 화일명만 추출해 내는) 에서 제대로 걸리지 않아서 문제가 되었던 듯 합니다. 저 부분을 수정했더니, 모질라에서는 제대로 동작하는 것을 확인했습니다. konqueror 는 당장 자바스크립트 쪽에서 말썽이었는데 그건 일단 넘어가고, 업로드의 경우 화일명에 한글이 있으니 안 되더군요. 디렉토리에 한글이 있는 것은 상관없었습니다. 혹시 MS윈도에서 IE 외에 다른 브라우저를 사용하시는 분들 계시면 [[연습장]]에서 업로드 테스트 좀 해봐주세요~ ---- [[위키위키분류]]