Skip to main content

[archive] CGI Upload file

  • October 8, 2009
  • 4 replies
  • 0 views

[Migrated content. Thread originally posted on 08 October 2009]

How can I upload a file with a cobol program cgi apache web server?

I have tried using this template:


File Name

Email




Using standard ACCEPT or C$GETCGI, "GET" or "POST" action, I'm able only to retrieve "filename" value, not its content.
I tried also reading standard input /dev/stdin inside cobol but no data back.

I'm missing something?

4 replies

[Migrated content. Thread originally posted on 08 October 2009]

How can I upload a file with a cobol program cgi apache web server?

I have tried using this template:


File Name

Email




Using standard ACCEPT or C$GETCGI, "GET" or "POST" action, I'm able only to retrieve "filename" value, not its content.
I tried also reading standard input /dev/stdin inside cobol but no data back.

I'm missing something?
I may misunderstand what you are trying to do: You have a HTML page that on the apache or IIS server runs a COBOL CGI program, you then want that COBOL program to open a file ( another HTML page or email attachment), sorry I'm confused.

[Migrated content. Thread originally posted on 08 October 2009]

How can I upload a file with a cobol program cgi apache web server?

I have tried using this template:


File Name

Email




Using standard ACCEPT or C$GETCGI, "GET" or "POST" action, I'm able only to retrieve "filename" value, not its content.
I tried also reading standard input /dev/stdin inside cobol but no data back.

I'm missing something?
I may misunderstand what you are trying to do: You have a HTML page that on the apache or IIS server runs a COBOL CGI program, you then want that COBOL program to open a file ( another HTML page or email attachment), sorry I'm confused.

[Migrated content. Thread originally posted on 08 October 2009]

How can I upload a file with a cobol program cgi apache web server?

I have tried using this template:


File Name

Email




Using standard ACCEPT or C$GETCGI, "GET" or "POST" action, I'm able only to retrieve "filename" value, not its content.
I tried also reading standard input /dev/stdin inside cobol but no data back.

I'm missing something?
I may misunderstand what you are trying to do: You have a HTML page that on the apache or IIS server runs a COBOL CGI program, you then want that COBOL program to open a file ( another HTML page or email attachment), sorry I'm confused.

[Migrated content. Thread originally posted on 08 October 2009]

How can I upload a file with a cobol program cgi apache web server?

I have tried using this template:


File Name

Email




Using standard ACCEPT or C$GETCGI, "GET" or "POST" action, I'm able only to retrieve "filename" value, not its content.
I tried also reading standard input /dev/stdin inside cobol but no data back.

I'm missing something?
i had the same probleme some years ago and found no solution in acucobol to realize this.

I manage the upload via php which redirect the upload-result to my acu-programm.



// In PHP kleiner als 4.1.0 sollten Sie $HTTP_POST_FILES anstatt $_FILES verwenden.
// In PHP kleiner als 4.0.3 verwenden Sie copy() und is_uploaded_file() anstatt von
// move_uploaded_file()
// Max Upload in php.ini im moment auf 50 MB gesetzt
// falls gr??er bitte ?ndern in php.ini: post_max_size, upload_max_filesize, memory_limit

$uploaddir = 'D:\\\\httpd\\\\intranet\\\\HtDocs\\\\v3\\\\download\\\\tmp\\\\';
$datei     = $_FILES['userfile']['name'];
$typ       = $_FILES['userfile']['type'];
$size      = $_FILES['userfile']['size'];
$session   = $_POST["session"];
$dateiname = 'Dateiname: ' . $datei . '
';
$dateityp  = 'Dateityp: ' . $typ . '
';
$dateisize = 'Dateigröße: ' . $size . '
';
$weiter    = 'weiter';

if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir . $_FILES['userfile']['name'])) {
   print "Datei wurde auf den Server kopiert. Hier ein Paar Informationen zu der Datei:\\n";
   print "

\\n";
   print_r($dateiname);
   print_r($dateityp);
   print_r($dateisize);
   print "

\\n";
   print_r($weiter);
} else {
   print "
";
   print "Fehler beim Uploaden der Datei, hier ein paar Informationen zur Fehlersuche:\\n";
   print_r($_FILES);
}

?>


sorry for the german parts in the code :)

You need in acu somthing like "move_uploaded_file" from php. But i found nothing in the acu-manual.

David