Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Remote upload
MichałK
post
Post #1





Grupa: Zarejestrowani
Postów: 10
Pomógł: 0
Dołączył: 2.02.2009

Ostrzeżenie: (0%)
-----


Witam,
Mój kolega napisał mi skrypt PHP, tak abym mógł pliki w formie http://serwer.pl/nazwapliku.zip przerzucać na swój serwer.
I na linuxpl skrypt działa doskonale jednak na 1and1 wywala mi błąd (IMG:style_emoticons/default/sad.gif) .
To jest ten skrypt:
  1. <?php
  2. define('upload', '/tmp/');
  3. $path = 'upload/';
  4. if(!empty($_POST['file_url'])) {
  5. $url = $_POST['file_url'];
  6. $response = ($response = downloadFile($url, $path)) ? 'Ścingnięto - <a href="'.$response.'">'.$response.'</a>' : 'Coś się jebło';
  7. }
  8. function downloadFile($url, $path) {
  9. $newfname = $path.uniqid('tmp_').'.tmp';
  10. $ext = 'bin';
  11. $file = fopen($url, "rb");
  12. if($file) {
  13. $newf = fopen($newfname, "wb");
  14. if($newf) {
  15. while(!feof($file)) fwrite($newf, fread($file, 1024 * 8 ), 1024 * 8 );
  16.  
  17. $mime = mime_content_type($newfname);
  18. switch($mime) {
  19. case 'application/x-rar-compressed':
  20. $ext = 'rar';
  21. break;
  22. case 'application/zip':
  23. $ext = 'zip';
  24. break;
  25. }
  26. }
  27. }
  28. if($file) fclose($file);
  29. if($newf) fclose($newf);
  30. $nn = $path.md5_file($newfname).'.'.$ext;
  31. rename($newfname, $nn);
  32. return 'http://'.$_SERVER['SERVER_NAME'].SUBD.$nn;
  33. }
  34. ?>
  35.  
  36. <!DOCTYPE html>
  37. <html>
  38. <head>
  39. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  40. <title>Giganigga9000</title>
  41. </head>
  42. <body>
  43.  
  44. <form method="post">
  45. <fieldset>
  46. <?php if(!empty($response)) echo '<h3>'.$response.'</h3>'; ?>
  47. <input type="url" value="url..." name="file_url" />
  48. <input type="submit" value="Ściągaj" />
  49. </fieldset>
  50. </form>
  51. <body>
  52. </html>


I po wklejeniu linku wyświetla mi się takie coś:
[php]
Warning: fopen() [function.fopen]: http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in E:\kunden\homepages\32\d426803178\www\test.php on line 11

Warning: fopen(http://www36.zippyshare.com/d/77897677/714423/stud.zip) [function.fopen]: failed to open stream: no suitable wrapper could be found in E:\kunden\homepages\32\d426803178\www\test.php on line 11

Warning: md5_file(upload/tmp_5023f1f97648a.tmp) [function.md5-file]: failed to open stream: No such file or directory in E:\kunden\homepages\32\d426803178\www\test.php on line 30

Warning: rename(upload/tmp_5023f1f97648a.tmp,upload/.bin) [function.rename]: The system cannot find the file specified. (code: 2) in E:\kunden\homepages\32\d426803178\www\test.php on line 31
[/php
Panowie z 1and1 sugerowali mi, że mogę coś zdziałać z php.ini
Jednak czy mają racje? Proszę o pomoc.
Z góry dziękuje.
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 12:16