Reply to Re: Upload without reload the page

Re: Upload without reload the page new!
by MDC888, 14 years ago
Thanks!

I went through this class, and it seems nice, but I need to avoid flash, in order to be Iphone compliant :(

Then I found this:
http://www.dhtmlx.com/docs/products/dhtmlxVault/index.shtml
(Full ajax uploader)

Here is their PHP code:
$id  = $_GET['sessionId'];
$id = trim($id);

session_name($id);
session_start();
$inputName = $_GET['userfile'];
$fileName  = $_FILES[$inputName]['name'];
$tempLoc   = $_FILES[$inputName]['tmp_name'];

echo $_FILES[$inputName]['error'];
$target_path = 'uploads/';
$target_path = $target_path . basename($fileName);
if(move_uploaded_file($tempLoc,$target_path)) // here they are just moving the file from the tmp directory to the new


And here is what I did:
include('class.upload.php');

$id  = $_GET['sessionId'];
$id = trim($id);

session_name($id);
session_start();
$inputName = $_GET['userfile'];
$fileName  = $_FILES[$inputName]['name'];
$tempLoc   = $_FILES[$inputName]['tmp_name'];

$target_path = 'uploads/';

// ---------- IMAGE UPLOAD ----------
$handle = new Upload($tempLoc); // Processing the file from the tmp directory -> is that OK?

if ($handle->uploaded) {

    $handle->image_resize            = true;
    $handle->image_ratio_y           = true;
    $handle->image_x                 = 300;

    $handle->Process($target_path);
    // we check if everything went OK
    if ($handle->processed) {
        // everything was fine !
        $_SESSION['dhxvlt_state'] = -1;
    } else {
        // one error occured
        $_SESSION['dhxvlt_state'] = -3;
    }
}

But that's not working...

Any idea?

THANKS!!!Reply

Your reply

Name *
Email 
Title *
Text *
CAPTCHA image
Enter the code displayed on the image:
Click on the image to generate another one if it is hard to read it. The case is important