tags. You can quickly insert code using ctrl + f.<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\">
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />
<title>Uploadify Example Script</title>
<link href=\"css/default.css\" rel=\"stylesheet\" type=\"text/css\" />
<link href=\"css/uploadify.css\" rel=\"stylesheet\" type=\"text/css\" />
<script type=\"text/javascript\" src=\"jquery-1.3.2.min.js\"></script>
<script type=\"text/javascript\" src=\"swfobject.js\"></script>
<script type=\"text/javascript\" src=\"jquery.uploadify.v2.0.2.min.js\"></script>
<script type=\"text/javascript\">
$(document).ready(function() {
$(\"#uploadify\").uploadify({
'uploader' : 'uploadify.swf',
'script' : 'uploadify.php',
'cancelImg' : 'cancel.png',
'folder' : 'uploads',
// 'queueID' : 'fileQueue',
'auto' : false,
'multi' : false,
onComplete: function (evt, queueID, fileObj, response, data) {
//alert(\"Response: \"+response); /* Return: 1 */
/* A really cool message that flashes then fades: */
$('#fileUploaded').html(data.filesUploaded + ' files were successfully uploaded.');
// Answere: \"undefined files were successfully uploaded.\" ... ? Why \"undefinded\"?
$('#fileUploaded').show().animate({'display':'block'},5000).hide(1000);
}
});
$(\"#form72submit\").click( function(){
name = ( $(\"#name\").val() == \"\" ) ? \"\" : $(\"#name\").val() ;
city = ( $(\"#city\").val() == \"\" ) ? \"\" : $(\"#city\").val() ;
$(\"#uploadify\").uploadifySettings(
'scriptData' , { 'name' : name , 'city' : city }
);
$(\"#uploadify\").uploadifyUpload();
return false;
});
});
</script>
</head>
<body>
<?php
if (!isset ($_POST['name']) or $_POST['name'] == '') {
?>
<form id=\"form72\" name=\"form72\" action=\"index.php\" accept-charset=\"UTF-8\" method=\"post\" enctype=\"multipart/form-data\">
<label for=\"name\" >Name&nbsp;</label>
<input type=\"text\" title=\"Name\" name=\"name\" id=\"name\" /><br />
<label for=\"city\" >City&nbsp;</label>
<input type=\"text\" title=\"City\" name=\"city\" id=\"city\" /><br />
<label for=\"upload\" >Upload&nbsp;</label>
<input type=\"file\" name=\"uploadify\" id=\"uploadify\" /><br />
<input type=\"button\" name=\"form72submit\" id=\"form72submit\" value=\"sendit\" />
</form>
<div id=\"fileUploaded\"></div>
<?php
} else if (isset ($_POST['name']) and $_POST['name'] != '') {
echo 'Name: '.$_POST['name'].'<br />';
echo 'City: '.$_POST['city'].'<br />';
echo 'Filename: '.$_POST['filename'].'<br />';
}
?>
</body>
</html>
The uploads will be handled in the upload.php script but the rest I need it in index.php.bdp said:You need to handle the submission of the post parameters in your upload.php script. It appears your are trying to handle them in index.php?
Can I not use JS to send the form after file upload?bdp said:The php code in index.php is only going to execute when the page loads. You are going use Javascript in your onComplete handler to insert that information into the DOM.
The uploads will be handled in the upload.php script but the rest I need it in index.php.Sven said:[quote="bdp"]You need to handle the submission of the post parameters in your upload.php script. It appears your are trying to handle them in index.php?
Can I not use JS to send the form after file upload?Sven said:
[quote="bdp"]The php code in index.php is only going to execute when the page loads. You are going use Javascript in your onComplete handler to insert that information into the DOM.
{'success':'true', 'filename':'foo.txt', 'description':'Stuff about foo', 'author':'Bill Foo'}
// Not the entire onComplete. If I could get to it right now I'd post it.
var data = eval('(' + r + ')');
// update field on form
$('#file_description').val = r.description;
$('#file_author').val = r.author;
...
It looks like you're new here. If you want to get involved, click one of these buttons!