Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP]Upload
Forum PHP.pl > Forum > Przedszkole
lukasz0021
Witam,
Mam taki problem, że nie mogę podać ścieżki do katalogu, w którym mają być ładowane pliki.
  1. <!doctype html public "-//w3c//dtd html 3.2//en">
  2. <html>
  3. <head>
  4. <title>upload</title>
  5. <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
  6. </head>
  7.  
  8. <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#0000ff" alink="#0000ff"
  9. topmargin="0" marginheight="0">
  10.  
  11. <?
  12. $mailheaders = "photo upload";
  13.  
  14. if ($email != "ftp.kassz@gmail.com") {
  15. } else {
  16. die("No email address specified.");
  17.  
  18. }
  19.  
  20. if ($superdat_name != "") {
  21. copy("$superdat", "/your/full/path/httpd/upload/files/$superdat_name") or
  22. die("Couldn't copy file.");
  23.  
  24. } else {
  25. die("No input file specified.");
  26. }
  27.  
  28. mail("ftp.kassz@gmail.com","$mailheaders", "$email sent $superdat_name, a $superdat_size byte file with a MIME type of $superdat_type \n nome :$name\n message :$message");
  29.  
  30. ?>
  31.  
  32. <html>
  33. <head>
  34.  
  35. <body bgcolor=white text=black link=blue>
  36.  
  37. <!--Header/Logo-->
  38. <p>&nbsp;</p>
  39. <p>&nbsp;</p>
  40.  
  41. <p align=center><h3>Your upload has been sent!</h3></p>
  42.  
  43. <p align=center>You have uploaded: <? echo "$superdat_name"; ?>, a <? echo "$superdat_size"; ?>
  44. byte file with a mime type of <? echo "$superdat_type"; ?>.See your photo <a href="http://www.yourwebsite\upload/files/<? echo "$superdat_name"; ?>">here</a></p>
  45. </body>
  46. </html>

Ścieżka znajduje się w tym samym katalogu gdzie skrypt, czyli /public_html/up/files
Katalogowi "files" nadałem prawa 777 i po załadowaniu jakiegokolwiek pliku wywala" No input file specified."
ścieżkę podałem w taki sposób
  1. if ($superdat_name != "") {
  2. copy("$superdat", "/public_html/up/files/$superdat_name") or
  3. die("Couldn't copy file.");

W pliku index.php nie zmieniałem nic
  1. !doctype html public "-//w3c//dtd html 3.2//en">
  2. <html>
  3. <head>
  4. <title>upload</title>
  5. </head>
  6.  
  7. <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#0000ff" alink="#0000ff"
  8. topmargin="0" marginheight="0">
  9.  
  10. <p>&nbsp;</p>
  11. <div align=center width=98%><h3> Upload Foto</h2><FORM ACTION="upload.php" METHOD="POST" ENCTYPE="multipart/form-data">
  12. <CENTER>
  13. <TABLE WIDTH=450 BORDER=0 CELLPADDING=0 CELLSPACING=0 id=news>
  14. <tr><td><b> Name :</b> </td>
  15. <td ><input type="text" name="name" size="40" maxlength="80" ></td></tr>
  16. <tr >
  17. <td width=113><b> email : </b> </td>
  18. <td width=289><p><input type=text name="email" size=30> </td>
  19. </tr>
  20.  
  21. <tr >
  22. <td width=113>
  23. <p align=right><b>photo to be sent: </b> </td>
  24. <td width=289>
  25. <p><input type=file name="superdat" size=30></p>
  26. </td>
  27. </tr>
  28. <tr>
  29. <td colspan=2 align=center><b>Message:</b>
  30. </td>
  31. </tr>
  32.  
  33. <tr>
  34. <td colspan=2 align=center>
  35. <textarea name="message" rows="3" cols="40"></textarea> </td>
  36. </tr>
  37.  
  38.  
  39. </TABLE>
  40. </CENTER>
  41. <DIV ALIGN=CENTER>
  42. <P STYLE="margin-bottom: 0in"><INPUT TYPE=SUBMIT NAME="submit" VALUE="Upload File"></P>
  43. </DIV>
  44. </FORM>



</body>
</html>
lobopol
co zawiera ta zmienna $superdat_name bo sprawdzasz czy nie jest pusta, ale nigdzie jej nie ustawiasz
lukasz0021
Cytat(lobopol @ 16.06.2013, 11:19:49 ) *
co zawiera ta zmienna $superdat_name bo sprawdzasz czy nie jest pusta, ale nigdzie jej nie ustawiasz

zmienna taka była w orginalnym skrypcie
lobopol
fajnie, ale co w niej jest? Jeżeli jest nieustawiona to nie ma prawa działać
lukasz0021
Pojęcia nie mam, co w niej jest i co ma w niej być ( szczerze)
do tego skryptu była dołączona taka instrukcja

The index.php is the form and the upload.php is the file that does the work
- create a folder in your webdirectory called upload and upload the files
- In this directory make another folder called files and set the permission to 777 the files folder this is where the files will get sent
- Now in the upload.php you have to change 3 variables one is the full path to your files folder /your/full/path/httpd/upload/files
- Second is the email address where the notification will be sent


PS. jeśli trzeba ją ustawić to jak to zrobić?
lobopol
Czyli nie masz pojęcia o php, zabierasz się za naukę od złej strony. Polecam ukończyć najpierw jakiś kurs php.

przed ifem zrób
  1. var_dump($superdat_name);
  2. if ($superdat_name != "") {

i możesz zobaczyć co się tam mieści

jeżeli puste, a zapewne tak to ustaw, ale pewnie i tak to nic nie da bo cały skrypt jest beznadziejny. No i działa tylko jak jest register_globals włączone.
lukasz0021
W takim razie gdzie mogę znaleźć skrypt uploadu z powiadomieniem na pocztę?
W sieci owszem są, ale bez powiadomienia na skrzynkę.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.