Click here to Skip to main content
15,909,651 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello , I am trying to finish my application. I am stuck with the photo uploader of Redactor. i am using asp.net Here is the usage of redactor :
XML
<script type="text/javascript">
        $(function() {
            $('#redactor_content').redactor({
                focus: true,
                imageUpload: '../redactor/PHP/image_upload.php'


            });
        });

       
    </script>



image_upload.php
XML
<html>
    <head>
        <title>

        </title>
    </head>
    <body>


<?php

// This is a simplified example, which doesn't cover security of uploaded images.
// This example just demonstrate the logic behind the process.


// files storage folder
$dir = '../redactor/IMAGES/';

$_FILES['file']['type'] = strtolower($_FILES['file']['type']);

if ($_FILES['file']['type'] == 'image/png'
|| $_FILES['file']['type'] == 'image/jpg'
|| $_FILES['file']['type'] == 'image/gif'
|| $_FILES['file']['type'] == 'image/jpeg'
|| $_FILES['file']['type'] == 'image/pjpeg')
{
    // setting file's mysterious name
    $filename = md5(date('YmdHis')).'.jpg';
    $file = $dir.$filename;

    // copying
    move_uploaded_file($_FILES['file']['tmp_name'], $file);

    // displaying file
    $array = array(
        'filelink' => 'http://redactor8/tmp/'.$filename
    );

    echo stripslashes(json_encode($array));

}

?>


    </body>
</html>
Posted
Updated 23-Dec-13 23:53pm
v2
Comments
Er. Tushar Srivastava 27-Dec-13 16:25pm    
I guess you haven't pointed out any error that you are getting. Please consider revising the question. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900