hi i have this CGI script which allows to upload a file to TeamSite from within a Data Capture Template (DCT). when i click on the upload file callout i get a window open for me and i browse to my local machine => then i chose the file that i need to upload to teamsite then after uploading it i get a message saying " you uploaded your file successfully"
here is the issue !!!
when i look for this file in TeamSite i cant find it. ?? i would apprecite any feed back regarding this . i am sure some of you have used this functionary. do i need to add anything here ???
the script below gets called by fileUploadform.ipl
use CGI;
my $cgi = new CGI;
# extract the file name selected for uploading
my $filename = $cgi->param("filename");
my $uploadFileHandle = $cgi->param("filename");
$filename =~ s/.*[\/\\](.*)/$1/;
my $target = $cgi->param("target");
# in this case we are uploading to a specific TS directory
my $uploadDir = "$target";
# check to see if the file already exists by attempting to open it for read. if we fail the file's not there,
# if we succeed then need to tell the user to rename the file before attempting to upload.
unless (open(TESTFILE, "<$uploadDir$filename"))
{
open(UPLOADFILE, ">$uploadDir$filename");
# both files must be in binary mode
binmode(UPLOADFILE);
binmode($uploadFileHandle);
# read from the source file and write to the target file
while(<$uploadFileHandle>)
{
print UPLOADFILE $_;
}
close UPLOADFILE;
# upload process complete, provide some feedback to the user
print $cgi->header();
ShowSuccess();
exit 0;
}
# file already exists
close(TESTFILE);
print $cgi->header();
ShowFailure();
exit 0;
# ###############################################################
# Method: ShowSuccess
# Purpose: Outputs the HTML to show a page to the user indicating
# that their file was successfully uploaded.
# ###############################################################
sub ShowSuccess
{
print <<"END";
File Upload Utility
<script language="JavaScript">
</script>
Your file has been uploaded successfully to this directory $uploadDir
(You uploaded: $filename)
Close
END
}