Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Hallo zusammen,

vorneweg, ich kann kein CGI bzw. Perl

ich bin auf der suche nach einem Perl FileUpload Script.

Bei google hab ich dazu diese Beispiel gefunden:


#!/usr/bin/perl
### NOTE: this is to demonstrate binary file upload, text file uploading is simple, but if you want to know how to do textfile uploading, just remove all the binmode() functions and that's it!
use CGI;
### Set Maximum Upload size to 2MB (prevent ppl from uploading extremely large files or other such malicious stuff)
$CGI::POST_MAX = 2048;
print "content-type: text/html\n\n";
### Set Standard Input to Binary Mode (this is critical for binary data (e.g. images) - the key piece of this code which nobody tells you (except me))
binmode(STDIN);
@inx = <STDIN>;
### This is just for a single file upload.. you can improve the code to include boundary separations and stuff like that..
### These two lines delete the boundary and file info which comes with the formfeed and leaves only the binary data
splice(@inx,0,4);
splice(@inx,$#inx,1);
$in = join("",@inx);
$in = substr($in,0,length($in) - 2);;
### This next sniplet assumes you are uploading a JPEG file and saves it as z.jpg in the folder this script is stored
### You can also further improve the script by retreiving the filename from the 'spliced' lines
open(ff,">z.jpg");
### Set file output to binary mode (since you're assuming to write a binary file)
binmode(ff);
print ff $in;
close(ff);
print "DONE, Uploaded Size: ".length($in)." bytes";
[/PHP]

Nun sieht das für mich so aus, als könnte dieses Script nur im binärmodus Files Uploaden.

Wie muss ich es modifizieren um alle arten von Files uploaden zu können?

Danke im vorraus

Hi,

du kannst prinzipiell im binmode alle Files übertragen.

Aber wenn du sie als Ascii übertragen willst (zum Steuerzeichen konvertieren), dann lass die Funktionen

binmode(STDIN);

binmode(ff);

einfach weg. Musst halt vorher ne Abfrage machen, ob es ein Text-File ist oder nicht und dann halt die dementsprechende Verzweigung.

cya

alligator

binmode ist ein Schalter der nur unter Windows funktioniert - unter allen andern Systemen wird der nicht beachet und hat keine Wirkung (und kann deswegen ignoriert werden).

Unter Windows sollte er halt stehen, damit die Dateioperationen genauso funktionieren wie nicht unter Windows.

Fazit: las's stehen - macht doch eh nix :)

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.