Project

General

Profile

« Previous | Next » 

Revision 7820

send the original filename in the upload() method since that is supported by the Metacat API. https://projects.ecoinformatics.org/ecoinfo/issues/6007

View differences:

src/perl/register-dataset.cgi
1192 1192
		return 0;
1193 1193
	}
1194 1194

  
1195
	# remove the uniqueness of the filename
1196
	# 'tempXXXXX'
1197
	$cleanName = substr($cleanName, 9);
1198
	
1195 1199
	if ( !$docid ) {
1196 1200
		$docid = newAccessionNumber( $config->{'scope'}, $metacat );
1197
		my $uploadReturn = uploadData( $outFile, $docid );
1201
		my $uploadReturn = uploadData( $outFile, $docid, $cleanName );
1198 1202
		if ( !$uploadReturn ) {
1199 1203
			debug("Uploading the data failed.");
1200 1204
		}
......
1207 1211
	# TODO:  should match the object promotion path, so that an
1208 1212
	#        Excel upload results in 'dataTable' in this field
1209 1213
	my $entityType = 'Other';
1210

  
1211
	# remove the uniqueness of the filename
1212
	# 'tempXXXXX'
1213
	$cleanName = substr($cleanName, 9);
1214 1214
	
1215 1215
	my %dataInfo = (
1216 1216
		'docid'       => $docid,
......
1387 1387
sub uploadData {
1388 1388
	my $data  = shift;
1389 1389
	my $docid = shift;
1390
	my $filename = shift;
1390 1391

  
1391 1392
	debug("Upload -- Starting upload of $docid");
1392
	my $response = $metacat->upload( $docid, $data );
1393
	my $response = $metacat->upload( $docid, $data, $filename );
1393 1394
	if ( !$response ) {
1394 1395
		my $uploadMsg = $metacat->getMessage();
1395 1396
		push( @errorMessages,
src/perl/Metacat/Metacat.pm
259 259
  my $self = shift;
260 260
  my $docid = shift;
261 261
  my $datafile = shift;
262
  my $filename = shift;
262 263

  
263 264
  my $returnval = 0;
264 265

  
265 266
  my %postData = ( action => 'upload',
266 267
                   docid => $docid,
267 268
                   datafile => [$datafile],
269
                   filename => $filename,
268 270
                   enctype => 'form-data'
269 271
                 );
270 272

  

Also available in: Unified diff