bruckerrlb Posted December 4, 2007 Share Posted December 4, 2007 Hello all, I have a simple script, yet I just cannot figure out how to get one part working. What will happen is the user uploads a picture. Then the user will have the option to insert that picture with a button in the text area (it's a cms). Yet I am having problems with the second part. Here is my code for the button the user will be using <input type="button" value="B" onClick="document.forms['submitnews']. elements['press'].value=document.forms['submitnews']. elements['press'].value+'<?php echo test; ?>'"> Where the echo test is, is where I want to put the address to the file, yet how it works is, first the user uploads a picture. Then it has all of the statements about that picture are echoed out for the user to see. How do I get that echo information into variables? Any help is much appreciated and if you need me to be more clear about something I will do that. Quote Link to comment Share on other sites More sharing options...
revraz Posted December 4, 2007 Share Posted December 4, 2007 Post all the echo statements. Quote Link to comment Share on other sites More sharing options...
bruckerrlb Posted December 4, 2007 Author Share Posted December 4, 2007 I'll post my storage code here and comment to let you know what's going on //if the submit button is pushed if(isset($_POST['submitvideo'])) { //defines what can be uploaded if (($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg") || ($_FILES["file"]["type"] == "application/x-shockwave-flash") || ($_FILES["file"]["type"] == "application/octet-stream") && ($_FILES["file"]["size"] < 2000000)) { if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { //if the files are good files then it will echo all the info here echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("uploads/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { //move them to a perm. folder move_uploaded_file($_FILES["file"]["tmp_name"], "uploads/" . $_FILES["file"]["name"]); $filepath = $_FILES["file"]["name"]; echo "Stored in: " . "uploads/" . $_FILES["file"]["name"]; //this was my attempt at using css to put the file in the div where I wanted it to go, it (I) failed echo "<div class\"imgdynamic\"><img src=\"uploads/$filepath\" /></div>"; //I am only storing flash video paths into a database if (($_FILES["file"]["type"] == "application/x-shockwave-flash")) { $query = "INSERT INTO videos (id, path) VALUES (0, '$thefile')"; if (@mysql_query ($query)) { print 'Successfully Added!'; } } } } } else { echo "Invalid file"; } } mysql_close(); ?> I hope that helps, thanks again! Quote Link to comment Share on other sites More sharing options...
bruckerrlb Posted December 4, 2007 Author Share Posted December 4, 2007 if there is anything else that I should post please let me know Quote Link to comment Share on other sites More sharing options...
bruckerrlb Posted December 5, 2007 Author Share Posted December 5, 2007 Anybody with any ideas? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.