Visualizzazione risultati 1 fino 3 di 3

Discussione: [PHP] Upload multiplo su TinyPic.com

  1. #1
    Guest

    Predefinito [PHP] Upload multiplo su TinyPic.com

    Ciao a tutti, sto realizzando uno script per uplodare più facilmente molte immagini su TinyPic.com con una classe trovata su internet, ma evidentemente non funziona! xD
    Sto seguendo questo esempio... ho scaricato naturalmente il file richiesto.
    Codice PHP:
    <center>
    <h1>Upload to TinyPic.com...</h1>
    <?
    if(isset($_POST["invia"])) {

    $img = $_POST["img"];

    /**
    * Uploading image to tinypic.com and retrieve the image's URL
    */
    include 'phpWebHacks.php';

    $h = new phpWebHacks;

    /* tinypic.com */
    $h->get('http://tinypic.com');

    /* get the hidden fields */
    $form = $h->parseForm('uploadForm', &$action);

    /* filetype = image, resize = default */
    $form['file_type'] = 'image';
    $form['dimension'] = '1600';

    /* 'browse' the image to upload */
    $file = "";

    foreach(
    $img as $id=>$url) {
    $file[$id] = array("the_url" => "{$url}");
    }

    /* submit */
    $page = $h->post($action, $form, $file);

    /* It will show a 'click here to view the image' page
    and then redirects using javascript.
    Since javascript is not supported, we need to manually
    parse the URL */
    preg_match('/<a\s+href\s*=\s*"(.+)".*>/iU', $page, $url);

    /* get the result page */
    $page = $h->get($url[1]);

    /* here is your URL */
    preg_match('/\[IMG\](.+)\[\/IMG\]/si', $page, $m);
    echo
    'Direct link: ' . $m[1]."<br />";

    }
    else {
    ?>
    <form method="POST">
    <?
    $max
    = 4;

    for(
    $i=0;$i<$max;$i++) {
    echo
    "<p><input type=\"text\" name=\"img[]\" size=\"60\" /></p>\n";
    }
    ?>
    <p><input type="submit" name="invia" value=" ... carica tutto ... " /></p>
    </form>
    <? } ?>
    </center>
    Warning: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of [runtime function name](). If you would like to enable call-time pass-by-reference, you can set allow_call_time_pass_reference to true in your INI file in C:\Programmi\AppServ\www\tinypic\index.php on line 19

    Warning: fopen(.log/headers.txt) [function.fopen]: failed to open stream: No such file or directory in C:\Programmi\AppServ\www\tinypic\phpWebHacks.php on line 69

    Warning: fputs(): supplied argument is not a valid stream resource in C:\Programmi\AppServ\www\tinypic\phpWebHacks.php on line 70

    Warning: fclose(): supplied argument is not a valid stream resource in C:\Programmi\AppServ\www\tinypic\phpWebHacks.php on line 71
    Grazie mille. Ciao, Davide! ^^"

  2. #2
    L'avatar di mycarlo
    mycarlo non è connesso Utente attivo
    Data registrazione
    06-10-2009
    Residenza
    $this->s50
    Messaggi
    467

    Predefinito

    Riesci a postare phpWebHacks.php?

    Non riesco ad andare sul sito che hai linkato sopra...

  3. #3
    Guest

    Predefinito

    Ma certo, eccolo: phpWebHacks.php
    Era troppo lungo...non lo accettava il forum! xD

Regole di scrittura

  • Non puoi creare nuove discussioni
  • Non puoi rispondere ai messaggi
  • Non puoi inserire allegati.
  • Non puoi modificare i tuoi messaggi
  •