searls03 Posted June 2, 2011 Share Posted June 2, 2011 I don't believe this is js help, so I put it here.....how do I pull the form field "id" and post to the database from this code? $(function(){ $('#swfupload-control').swfupload({ upload_url: "upload-file.php", file_post_name: 'uploadfile', file_size_limit : "9999999999999999999999999999999999", file_types : "*", file_types_description : "Image files", file_upload_limit : 1000, flash_url : "js/swfupload/swfupload.swf", button_image_url : 'js/swfupload/wdp_buttons_upload_114x29.png', button_width : 114, button_height : 29, button_placeholder : $('#button')[0], debug: false }) .bind('fileQueued', function(event, file){ var listitem='<li id="'+file.id+'" >'+ 'File: <em>'+file.name+'</em> ('+Math.round(file.size/1024)+' KB) <span class="progressvalue" ></span>'+ '<div class="progressbar" ><div class="progress" > ////////////////////////right here <input type="hidden" name="id" value="<?php echo $str; ?>" /></div></div>'+ '<p class="status" >Pending</p>'+ '<span class="cancel" > </span>'+ here is the code that posts: <?php include_once "secure/connect_to_mysql.php"; $uploaddir = 'images/'; $id= $_POST['id']; $file = $uploaddir . basename($_FILES['uploadfile']['name']); $size=$_FILES['uploadfile']['size']; if($size>999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999) { echo "error file size > 1 MB"; unlink($_FILES['uploadfile']['tmp_name']); exit; } if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $file)) { echo "success"; } else { echo "error ".$_FILES['uploadfile']['error']." --- ".$_FILES['uploadfile']['tmp_name']." %%% ".$file."($size)"; } $sql = "INSERT INTO pictures(image, id) VALUES('$file', '$id')"; $rs = mysql_query($sql) or die ("Problem with the query: $sql<br>" . mysql_error()); echo mysql_error(); ?> Link to comment https://forums.phpfreaks.com/topic/238230-pull-info-for-posting-from-javascript-code-area/ Share on other sites More sharing options...
searls03 Posted June 2, 2011 Author Share Posted June 2, 2011 or is it not possible because it is not marked as a form? how could I implement that into the js then so that it submits when the document uploads?????make sense? Link to comment https://forums.phpfreaks.com/topic/238230-pull-info-for-posting-from-javascript-code-area/#findComment-1224249 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.