Highlighted
Absent Member.
Absent Member.
1038 views

[archive] CGI Upload file

[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?
0 Likes
2 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] CGI Upload file

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.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] CGI Upload file

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
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.