kasparkuldkepp / upload-at-click

Automatically exported from code.google.com/p/upload-at-click
0 stars 0 forks source link

When uploading, file not being passed on to PHP file (server) #52

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

I have replicated the code in the Project Home section. However, when I attempt 
to upload the file, PHP cannot recognize any values for 
$_FILES["Filedata"]["type"], $_FILES["Filedata"]["size"] and 
$_FILES["Filedata"]["tmp_name"] - resulting in the upload failing.

I have stripped down my html and php files to the relevant parts (below, and 
attached). Am I missing out on something trivial?

I have checked the basics - such as ensuring the paths are correct and 
accessible, etc.

Could you please help me out?

Thanks,
Kedar

HTML Code: (test.html)
<html>
<head> 
    <script type="text/javascript" src="./jscripts/upclick.js"></script> 
</head> 
<body> 
    <input type="button" id="uploader" value="Upload">
    <script type="text/javascript"> 
        var element = document.getElementById('uploader');
        upclick( {
            element:element, 
            action: './pscripts/test_upload.php',
            onstart: 
                function(filename)      { alert('Starting upload: '+filename); },
            oncomplete:
                function(response_data) { console.log(response_data); }
        } );
</script> 
</body> 
</html>

PHP (test_upload.php)
<?php
    $result = '{ "session_msg": "' . $session_msg . '", ';
    $result = $result . '"fileName": "' . $_FILES["Filedata"]["name"]           . '",';
    $result = $result . '"fileType": "' . $_FILES["Filedata"]["type"]           . '",';
    $result = $result . '"fileSize": "' . $_FILES["Filedata"]["size"]           . '",';
    $result = $result . '"fileNameTemp": "' . $_FILES["Filedata"]["tmp_name"]   . '",';
    $result = $result . '"time": "' . date('d-M-y h:m:s') . '"}';
    echo $result;
?>

How to reproduce the problem?

Please describe step by step:
1. script call...
2. what to do...
3. what happened...

Optional:
4. what was expected...
5. URL on your site. If possible.

Original issue reported on code.google.com by ked...@gmail.com on 1 Jun 2014 at 4:54

Attachments: