my code
jquery
<script type="text/javascript">
$(document).ready(function() {
$('.up').click(function() {
$('#postbox').load("uploader.php" );
return false;
});
});
html
<form enctype="multipart/form-data" action="uploader.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Wybierz plik: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Wyślij" class="up"/>
</form>
<INPUT TYPE = "Text" VALUE ="długość" NAME = "długość"><INPUT TYPE = "Text" VALUE ="wysokość" NAME = "wysokość">
<INPUT TYPE = "Text" VALUE ="jakość [1-12]" NAME = "długość">
<div id="postbox">
</div>
now, my uploader.php file opens in #postbox, but i need to add parameters too
I just need php file uploader.php to display in #postbox div, after form parameters are passed to it. Now it displays "error while uploading the file", because it doesnt get file to upload.
.load
allows you to send data as the second argument.
$('.up').click(function(e) {
$postbox = $('#postbox');
if( $postbox.find('form').length === 0 )
$postbox.load('uploader.php');
else
{
var form_values = {};
$.each($postbox.serializeArray(), function(i,v){ form_values[ v.name ] = v.value })
$postbox.load('uploader.php', form_values );
}
e.preventDefault();
})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.