• 12-11-2010, 11:59:30
    #1
    arkadaşlar php den anlamadığım için biraz zorlandım hatta çözemedim

    <?php

    $result = array();

    $result['time'] = date('r');
    $result['addr'] = substr_replace(gethostbyaddr($_SERVER['REMOTE_ADDR']), '******', 0, 6);
    $result['agent'] = $_SERVER['HTTP_USER_AGENT'];

    if (count($_GET)) {
    $result['get'] = $_GET;
    }
    if (count($_POST)) {
    $result['post'] = $_POST;
    }
    if (count($_FILES)) {
    $result['files'] = $_FILES;
    }

    // we kill an old file to keep the size small
    if (file_exists('script.log') && filesize('script.log') > 102400) {
    unlink('script.log');
    }

    $log = @fopen('script.log', 'a');
    if ($log) {
    fputs($log, print_r($result, true) . "\n---\n");
    fclose($log);
    }


    // Validation

    $error = false;

    if (!isset($_FILES['Filedata']) || !is_uploaded_file($_FILES['Filedata']['tmp_name'])) {
    $error = 'Invalid Upload';
    }

    if ($error) {

    $return = array(
    'status' => '0',
    'error' => $error
    );

    } else {

    $return = array(
    'status' => '1',
    'name' => $_FILES['Filedata']['name']
    );

    // Our processing, we get a hash value from the file
    $return['hash'] = md5_file($_FILES['Filedata']['tmp_name']);

    // ... and if available, we get image data
    $info = @getimagesize($_FILES['Filedata']['tmp_name']);

    if ($info) {
    $return['width'] = $info[0];
    $return['height'] = $info[1];
    $return['mime'] = $info['mime'];
    }

    }

    // Output

    if (isset($_REQUEST['response']) && $_REQUEST['response'] == 'xml') {
    // header('Content-type: text/xml');

    // Really dirty, use DOM and CDATA section!
    echo '<response>';
    foreach ($return as $key => $value) {
    echo "<$key><![CDATA[$value]]></$key>";
    }
    echo '</response>';
    } else {
    // header('Content-type: application/json');

    echo json_encode($return);
    }
    ?>


    bu kodu c#a çevirmek istiyorum bu kod FancyUpload ın Script.php dosyası.
  • 12-11-2010, 13:21:16
    #2
    Burada C# ile yapamayacağın ne var ki ?

    Eğer asp.net ile yazılmış açık kaynak kodlu güzel bir upload componenti arıyorsan,
    http://neatupload.codeplex.com/ adresindeki netupload'ı karıştırabilirsin.
  • 12-11-2010, 21:54:39
    #3
    upload sistemimde sorun yok sadece phpden hiç anlamadığım için burada ne yapıldığını ve neyin ne çekildiğini anlamadım bi türlü.

    c#da zaten kendi yazdığım upload sistemim var sorunsuz. ama bir türlü php yi anlayamadım.
  • 12-11-2010, 23:07:27
    #4
    arkadaşlar kendi sitelerinde zaten vermişler kodu sonradan gördüm teşekkür ederim herkeze.

    yardımcı olmak için kodu da vereyim

    http://digitarald.de/forums/topic.php?id=489

    burada mevcut imiş.