Autor Beitrag
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Mi 22.06.05 19:47 
Moin... ;)

Irgendwie bekomme ich immer eine Fehlermeldung, wenn ich Dateien von meinem eigenen PC auf meinen Webspace per PHP-Skript uploaden will.

ausblenden Quelltext
1:
2:
3:
<?php
copy ("C:\\testbild.bmp", "save.bmp");
?>


Der Code will schon nicht.

Zitat:
Warning: copy(C:\testbild.bmp): failed to open stream: No such file or directory in **********/test.php on line 2


Danke schonmal... ;)
StefanH
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: Mi 22.06.05 19:55 
probier mal
ausblenden Quelltext
1:
2:
3:
<?php
copy ("C:/testbild.bmp", "save.bmp");
?>


... so müsste es eigentlich gehen. :P

_________________
"Als es noch keine Computer gab, war das Programmieren noch relativ einfach."(Edsger W. Dijkstra)
"Ich bin nicht von Sinnen, sondern ich rede wahre und vernünftige Worte." (Paulus)
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 22.06.05 20:02 
Verstehe ich das richtig? Du willst, dass sich ein PHP-Skript, welches auf Deinem Webspace läuft, einfach so eine Datei von Deinem Rechner runterkopiert? Ohne dass der User noch irgendwie seine Zustimmung geben muss?

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
StefanH
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: Mi 22.06.05 20:06 
user profile iconChristian S. hat folgendes geschrieben:
Verstehe ich das richtig? Du willst, dass sich ein PHP-Skript, welches auf Deinem Webspace läuft, einfach so eine Datei von Deinem Rechner runterkopiert? Ohne dass der User noch irgendwie seine Zustimmung geben muss?


ich denk mal, er hat ausprobiert, wie diese funktion funkioniert und/oder den code hier vereinfacht dargestellt...
und außerdem will er ja "Dateien von seinem eigenen PC auf seinen Webspace per PHP-Skript uploaden"

;)
//edit: quote-tags entfernt.. sah blöd aus.

_________________
"Als es noch keine Computer gab, war das Programmieren noch relativ einfach."(Edsger W. Dijkstra)
"Ich bin nicht von Sinnen, sondern ich rede wahre und vernünftige Worte." (Paulus)
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 22.06.05 20:29 
Vielleicht ist das falsch rüber gekommen: Es liegt mir fern, hier irgendwem was böses unterstellen zu wollen. Aber es würde mich sehr schockieren, wenn das ginge, weil es ja dann jeder Webserver-Betreiber mit jedem Rechner machen könnte. ;-)

Die einzige Möglichkeit, die ich kenne, ist halt das Upload-Fomrular, welches auch im Attachment-Mod verwendet wird.

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
WeBsPaCe Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Mi 22.06.05 20:39 
user profile iconStefanH hat folgendes geschrieben:
probier mal
ausblenden Quelltext
1:
2:
3:
<?php
copy ("C:/testbild.bmp", "save.bmp");
?>

... so müsste es eigentlich gehen. :P

Nö. Geht immer noch nicht... :gruebel:

user profile iconChristian S. hat folgendes geschrieben:
Verstehe ich das richtig? Du willst, dass sich ein PHP-Skript, welches auf Deinem Webspace läuft, einfach so eine Datei von Deinem Rechner runterkopiert? Ohne dass der User noch irgendwie seine Zustimmung geben muss?

Nee... So nicht... ;) Ich hab ein Upload-Skript. Und das soll eine Datei von meinem bzw. dem PC des Besuchers dieses Skript auf den Webspace uploaden... ;)

user profile iconChristian S. hat folgendes geschrieben:
Vielleicht ist das falsch rüber gekommen: Es liegt mir fern, hier irgendwem was böses unterstellen zu wollen.

Und noch dazu mir... :mrgreen:

user profile iconChristian S. hat folgendes geschrieben:
Die einzige Möglichkeit, die ich kenne, ist halt das Upload-Fomrular, welches auch im Attachment-Mod verwendet wird.

Genau sowas meine ich... ;)
StefanH
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: Mi 22.06.05 20:41 
user profile iconChristian S. hat folgendes geschrieben:
Vielleicht ist das falsch rüber gekommen: Es liegt mir fern, hier irgendwem was böses unterstellen zu wollen. Aber es würde mich sehr schockieren, wenn das ginge, weil es ja dann jeder Webserver-Betreiber mit jedem Rechner machen könnte. ;-)

ich wollte dir nciht unterstellen, irgendwem etwas böses zu unterstellen... ;)

user profile iconChristian S. hat folgendes geschrieben:
Die einzige Möglichkeit, die ich kenne, ist halt das Upload-Fomrular, welches auch im Attachment-Mod verwendet wird.


hm.. der einzige unterschied ist der enctype im form tag.. multipart/form-data aber das ist imho nur dafür da, zu sagen, was großes geschickt wird (oder so ähnlich :roll:)



user profile iconWeBsPaCe hat folgendes geschrieben:
Nö. Geht immer noch nicht... :gruebel:

mh.. gleicher Fehler?

_________________
"Als es noch keine Computer gab, war das Programmieren noch relativ einfach."(Edsger W. Dijkstra)
"Ich bin nicht von Sinnen, sondern ich rede wahre und vernünftige Worte." (Paulus)
WeBsPaCe Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Mi 22.06.05 20:49 
user profile iconStefanH hat folgendes geschrieben:
mh.. gleicher Fehler?

Jop. :eyes:
UC-Chewie
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 531

WinXP
D5 Ent
BeitragVerfasst: Mi 22.06.05 20:58 
Lies dir mal den entsprechenden Abschnitt im PHP-Manual durch: de.php.net/manual/de...ures.file-upload.php

_________________
Egal wie dumm man selbst ist, es gibt immer andere, die noch dümmer sind
WeBsPaCe Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Mi 22.06.05 21:02 
user profile iconUC-Chewie hat folgendes geschrieben:
Lies dir mal den entsprechenden Abschnitt im PHP-Manual durch: de.php.net/manual/de...ures.file-upload.php

Hab ich. Konnte aber nichts finden, was mein Problem irgendwie löst... :gruebel:
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Mi 22.06.05 21:04 
user profile iconStefanH hat folgendes geschrieben:
hm.. der einzige unterschied ist der enctype im form tag.. multipart/form-data aber das ist imho nur dafür da, zu sagen, was großes geschickt wird (oder so ähnlich :roll:)
Der Unterschied ist sehr viel größer! Wenn Du es über das Formular machst, dann wird beim Absendes des Formulars die Datei vom Browser (also dem Client) an den Server gesendet, der sie in einem temporären Verzeichnis ablegt. Was WeBsPaCe anscheinend möchte ist, dass das PHP-Skript (also der Server) die Datei holt. Das ist schon ein gewaltiger Unterschied!

@WeBsPaCe: UC-Chewies Link führt zum Erfolg - über ein Upload-Formular ;-)

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
StefanH
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: Mi 22.06.05 21:11 
user profile iconChristian S. hat folgendes geschrieben:
user profile iconStefanH hat folgendes geschrieben:
hm.. der einzige unterschied ist der enctype im form tag.. multipart/form-data aber das ist imho nur dafür da, zu sagen, was großes geschickt wird (oder so ähnlich :roll:)
Der Unterschied ist sehr viel größer! Wenn Du es über das Formular machst, dann wird beim Absendes des Formulars die Datei vom Browser (also dem Client) an den Server gesendet, der sie in einem temporären Verzeichnis ablegt. Was WeBsPaCe anscheinend möchte ist, dass das PHP-Skript (also der Server) die Datei holt. Das ist schon ein gewaltiger Unterschied!

@WeBsPaCe: UC-Chewies Link führt zum Erfolg - über ein Upload-Formular ;-)


:autsch: ich dachte, man muss nimmt die Datei und lädt sie dann mit php hoch... :oops: aber das ist ja wirklich ein schwachsinniger gedanke.. mein fehler..

jo.. ein upload-formular und dann das mit move_uploaded_file an die richtige stelle schieben.

_________________
"Als es noch keine Computer gab, war das Programmieren noch relativ einfach."(Edsger W. Dijkstra)
"Ich bin nicht von Sinnen, sondern ich rede wahre und vernünftige Worte." (Paulus)
WeBsPaCe Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Mi 22.06.05 21:12 
:gruebel: Okay....


Ich probier's aus und melde mich dann wieder... ;)
Duron
half ontopic starofftopic starofftopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 19



BeitragVerfasst: Do 23.06.05 10:29 
Versuch es mal hiermit:

ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
<?php
  if($was=="doit") {

    $size = $bild_size; // Größe der Datei

    $name = $bild_name; // Der Originalname

    $type = $bild_type; // Der MIME Type der Datei


    if(eregi("(jpg|gif|txt|htm|html)$",$name)) {
    if($size<6000 AND $size!=0) {
      copy($bild,$name); // Kopiert das Bild

      echo "Die Datei erfolgreich hochgeladen.<br>";
      echo "Größe: ".$size." Byte<br>";
      echo "Name: ".$name."<br>";
      echo "MIME-Type: ".$type."<br>";
      echo "Ansehen: <a href='".$name."'>".$name."</a>"; 
    } else {
      echo "Ihre Datei ist über 5,5 KB oder gleich 0"; 
    }
    } else {
    echo "Falsche Erweiterung: ".$name;
    }

  } else {

    echo "<form action='".$PHP_SELF."' enctype=\"multipart/form-data\" method='post'>";
    echo "<input type='hidden' name='was' value='doit'>";
    echo "<table>";
    echo "<tr>";
      echo "<td>Datei</td>";
      echo "<td><input type='file' name='bild'></td>";
    echo "</tr><tr>";
      echo "<td> </td>";
      echo "<td><input type='submit' value='Hochladen'></td>";
    echo "</tr>";
    echo "</form></table>";
  }
?>
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Do 23.06.05 11:23 
@Duron: Also ich hab den Code mal getestet, leider passiert bei mir gar nix, d.h. es kommt immer wieder nur das Formular.
Und ja, PHP ist auf dem Server korrekt eingerichtet, daran liegts nicht, falls du das fragen wolltest...

Ich versuch mal den Fehler zu finden.

//edit:
ja, wie ich es mir dachte, das doit kommt nicht an, nach dem Senden ist $was immer noch leer.
Duron
half ontopic starofftopic starofftopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 19



BeitragVerfasst: Do 23.06.05 13:48 
dann ist register_globals auf off...dann musst du mit den systemvariablen arbeiten!
DaClown
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 68



BeitragVerfasst: Do 23.06.05 14:36 
Sprich statt $was muss du $_POST['was'] benutzen
Duron
half ontopic starofftopic starofftopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 19



BeitragVerfasst: Do 23.06.05 14:46 
ja und $_FILES['uploaded_file'] für die Uploaddatei u.s.w. für die anderen Variablen!