AjaxFileUpload Plugin does not retrieve $_POST or $_FILES data

nwjjlh

New Member
Ok, I hope this will be my last question in a series of Q's regarding dynamic file upload.I'm using AjaxFileUpload Plugin and try to work with the FORM data in my uploader.php. The problem is that both \[code\]$_POST\[/code\] and \[code\]$_FILES\[/code\] is NULL.This is my HTML code:\[code\] <form id="uploadForm" enctype="multipart/form-data" action="" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="http://stackoverflow.com/questions/3675908/1000000" /> <input type="hidden" name="current_path" value="http://stackoverflow.com/questions/3675908/<?php echo $fb->relative_url; ?>" /> <input id="uploadFile" name="uploadFile" type="file" /> <input type="button" class="button uploadImage" value="http://stackoverflow.com/questions/3675908/<?php _e('Upload File') ?>" /> <br /> </form> \[/code\]And this is my JS script:\[code\] //File upload jQuery('.uploadImage').live('click',function() { ajaxFileUpload(); }); (...) function ajaxFileUpload() { jQuery.ajaxFileUpload ( { url:'../wp-content/plugins/wp-filebrowser/uploader.php', secureuri:false, fileElementId:'uploadFile', dataType: 'json', success: function (data, status) { alert('Error: ' + data.error + ' - Respons: ' + data.respons) }, error: function (data, status, e) { alert('Error: ' + e); } } ) return false; }\[/code\]To test that I data is submited, I have the following PHP code:\[code\] $data['error'] = $_POST['current_path']; // Gives me NULL $data['respons'] = $_FILES['uploadFile']['name']; // Gives me NULL // Return result in json echo json_encode($data); \[/code\]UPDATEAfter very good help from Pekka (with his good set of eyes), I have got it working! The code is updated with the correct code.
 
Back
Top