Jump to content

accend

Members
  • Posts

    17
  • Joined

  • Last visited

Everything posted by accend

  1. If I comment the headers out, I see the html fine, red border around the div etc but nothing loads inside it, except for a load of code associated with the actual pdf, so the header translates it, and its def needed. Put the headers back, pdf takes over the full page and the object has no effect on it what so ever, the headers take over to display the pdf in full. I'm sorry this is still going on...
  2. I'll go back through the threads again and see what has happened. It did work though when I put the pdf on the root level and pulled it in directly by hardcoding the path into the object. Very strange, but will go through it all again and see if anything i have done is wrong. The trouble is its pretty simple. <?php session_start(); require_once('../auth.php'); include "../config.php"; error_reporting(E_ALL); ini_set('display_errors','On'); if(isset($_GET['pdf'])) { $stock_Id=$_GET['pdf']; $a=mysql_query("select Document from Documents where ID=$stock_Id") or die (mysql_error()); while($s=mysql_fetch_assoc($a)){ $cdocdocb=$s["Document"]; } } $file = "$cdocdocb"; header('Content-type: application/pdf'); header('Content-Disposition: inline; filename="$file"'); $filename=file_get_contents($file); $code=<<<heredocs <!DOCTYPE html> <html> <head> <title>pdf in a page</title> <style type='text/css'> #pdf { position:relative; float:left; width: 300px; height: 300px; margin: 1%; // border: 2px solid red; } #pdf p { padding: 10px; } #pdf object { display: block; border: solid 3px red; } </style> </head> <body> <!-- begin DIV to hold the PDF --> <!-- begin DIV to hold the PDF --> <!-- begin DIV to hold the PDF --> <center> Version 5 <form method='POST'> Click here to close this and go back <input type='submit' name='btn' value='Return'> </form> </center> <br><br> <div id="pdf"> heredocs; echo $code; echo "<object data='" .$filename . "#scrollbar=1' type='application/pdf' width='100%' height='100%'><p>It appears you don't have a PDF plugin for this browser. No biggie... you can <a href='$filename'>click here to download the PDF file.</a></p></object>"; //toolbar=1&navpanes=0& echo "</div></body></html>"; exit();
  3. The trouble is I just cant put these pdf's on the root level, they are very sensitive and must be kept in the cgi-bin folder, so because nothing is recognised in that folder other than cgi files, the pdf's need to be re-created I suppose into pdf's for them to be displayed, so that is the problem there, its just for some reason the pdf then has to display full width and height, and over runs the html on the page.
  4. Hi ginerjm, thanks for the help mate, its a very strange thing where something that seems so easy to sort out, just isnt. I think its got something to do with the pdf's being stored in the cgi-bin folder, and not just on the root level.
  5. Hi, Thought we had it then... All good except that the pdf inside the div comes out all in code. Then I put the headers back to compliment it, and it took over the screen again. On thing about out of this that is making me happy, is that it wasnt that i was being lazy and not trying ot look for the answer, its so strange that it just wont work. Thanks though for replying, its great that you are helping.
  6. Hi, The good news is that your way above works perfectly. I moved the pdf outside the private folder, and hey presto on refresh with your code the pdf appears in the window. When I tried to integrate my code into it, as I have it, the pdf once again took over the whole page and then I replied back to you. Is it to do with the fact that the pdf is in the private folder on the server, as they are very sensitive information. The code below nearly works in that the pdf does try and load into the box but the initializing feedback keep showing, and the pdf doesnt load. <?php session_start(); require_once('../auth.php'); include "../config.php"; error_reporting(E_ALL); ini_set('display_errors','On'); if(isset($_GET['pdf'])) { $stock_Id=$_GET['pdf']; $a=mysql_query("select Document from Documents where ID=$stock_Id") or die (mysql_error()); while($s=mysql_fetch_assoc($a)){ $cdocdocb=$s["Document"]; } } $filename = "$cdocdocb"; $code=<<<heredocs <!DOCTYPE html> <html> <head> <title>pdf in a page</title> <style type='text/css'> #pdf { position:relative; float:left; width: 300px; height: 300px; margin: 1%; // border: 2px solid red; } #pdf p { padding: 10px; } #pdf object { display: block; border: solid 3px red; } </style> </head> <body> <!-- begin DIV to hold the PDF --> <!-- begin DIV to hold the PDF --> <!-- begin DIV to hold the PDF --> <center> Version 5 <form method='POST'> Click here to close this and go back <input type='submit' name='btn' value='Return'> </form> </center> <br><br> <div id="pdf"> heredocs; echo $code; echo "<object data='" .$filename . "#scrollbar=1' type='application/pdf' width='100%' height='100%'><p>It appears you don't have a PDF plugin for this browser. No biggie... you can <a href='$filename'>click here to download the PDF file.</a></p></object>"; //toolbar=1&navpanes=0& echo "</div></body></html>"; exit(); But once i then add in the $filename=readfile($file); the pdf loads but its full screen. <?php session_start(); require_once('../auth.php'); include "../config.php"; error_reporting(E_ALL); ini_set('display_errors','On'); if(isset($_GET['pdf'])) { $stock_Id=$_GET['pdf']; $a=mysql_query("select Document from Documents where ID=$stock_Id") or die (mysql_error()); while($s=mysql_fetch_assoc($a)){ $cdocdocb=$s["Document"]; } } $file = "$cdocdocb"; $filename=readfile($file); $code=<<<heredocs <!DOCTYPE html> <html> <head> <title>pdf in a page</title> <style type='text/css'> #pdf { position:relative; float:left; width: 300px; height: 300px; margin: 1%; // border: 2px solid red; } #pdf p { padding: 10px; } #pdf object { display: block; border: solid 3px red; } </style> </head> <body> <!-- begin DIV to hold the PDF --> <!-- begin DIV to hold the PDF --> <!-- begin DIV to hold the PDF --> <center> Version 5 <form method='POST'> Click here to close this and go back <input type='submit' name='btn' value='Return'> </form> </center> <br><br> <div id="pdf"> heredocs; echo $code; echo "<object data='" .$filename . "#scrollbar=1' type='application/pdf' width='100%' height='100%'><p>It appears you don't have a PDF plugin for this browser. No biggie... you can <a href='$filename'>click here to download the PDF file.</a></p></object>"; //toolbar=1&navpanes=0& echo "</div></body></html>"; exit();
  7. Ok this is how it is now <?php session_start(); require_once('../auth.php'); include "../config.php"; error_reporting(E_ALL); ini_set('display_errors','On'); if(isset($_GET['pdf'])) { $stock_Id=$_GET['pdf']; $a=mysql_query("select Document from Documents where ID=$stock_Id") or die (mysql_error()); while($s=mysql_fetch_assoc($a)){ $cdocdocb=$s["Document"]; } } $file="$cdocdocb"; //header('Content-type: application/pdf'); //header('Content-Disposition: inline; filename="$file"'); $readPDF=readfile($file); //echo "<p>$file</p>"; ?> <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>utgroup admin</title> <meta content="text/html; charset=utf-8" http-equiv="Content-type" /> <style type="text/css"> #pdf { width: 50%; height: 300px; margin: 2em auto; border: 2px solid red; } #pdf p { padding: 1em; } #pdf object { display: block; border: solid 1px yellow; } </style> </head> <body> <center> <form method='POST'> Click here to close this to back <input type='submit' name='btn' value='Return'> </form> </center> <br><br> <div id="pdf"> <object data="<?php echo $readPDF;?>" type="application/pdf" width="100%" height="100%"> <p>It appears you don't have a PDF plugin for this browser. No biggie... you can <a href="firehouse_ad_hvvfa_sample1.pdf">click here to download the PDF file.</a></p> </object> </div> </body> </html> And what happens is that in IE its still full screen and I can see the pdf, and in mozilla the top half of the page is a load of strange code symbols, and the bottom bit is the you havent got pdf reader message. Please dont shout at me lol...
  8. I took this header out - header('Content-type: application/pdf'); and it then comes back with no pdf reader, and tried the other and that has no effect on it at all. I'm honestly stuck with it lol.... no errors though, took @ out. how emabarrasing!
  9. Ok one thing I have noticed on checking is that the object is being made redundant, because whether @readfile($file) is being put into a var or being used directly in object doesnt matter, because @readfile($file) is there in the code somewhere, its reading it and not even go as far down the page as the html
  10. Sorry i did have html in there, just forgot to put it in the reply as below... Apologise once again if im not doing somethng right, but it looks fine to me, and it still outputs full screen, and overrides any html on the page. <?php session_start(); require_once('../auth.php'); include "../config.php"; error_reporting(E_ALL); ini_set('display_errors','On'); if(isset($_GET['pdf'])) { $stock_Id=$_GET['pdf']; $a=mysql_query("select Document from Documents where ID=$stock_Id") or die (mysql_error()); while($s=mysql_fetch_assoc($a)){ $cdocdocb=$s["Document"]; } } $file="$cdocdocb"; header('Content-type: application/pdf'); header('Content-Disposition: inline; filename="$file"'); $readPDF=@readfile($file); //echo "<p>$file</p>"; ?> <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>utgroup admin</title> <meta content="text/html; charset=utf-8" http-equiv="Content-type" /> <style type="text/css"> #pdf { width: 50%; height: 300px; margin: 2em auto; border: 2px solid red; } #pdf p { padding: 1em; } #pdf object { display: block; border: solid 1px yellow; } </style> </head> <body> <center> <form method='POST'> Click here to close this to back <input type='submit' name='btn' value='Return'> </form> </center> <br><br> <div id="pdf"> <object data="<?php echo $readPDF;?>" type="application/pdf" width="100%" height="100%"> <p>It appears you don't have a PDF plugin for this browser. No biggie... you can <a href="firehouse_ad_hvvfa_sample1.pdf">click here to download the PDF file.</a></p> </object> </div> </body> </html>
  11. I cant believe how I'm just not getting it in honesty, but with what i have got below, the pdf still shows full screen, and no sign of any html. I think I have tried your way and all I get when I load the page is a full screen of the pdf, for some reason i cant manage its size at all. <?php session_start(); require_once('../auth.php'); include "../config.php"; error_reporting(E_ALL); ini_set('display_errors','On'); if(isset($_GET['pdf'])) { $stock_Id=$_GET['pdf']; $a=mysql_query("select Document from Documents where ID=$stock_Id") or die (mysql_error()); while($s=mysql_fetch_assoc($a)){ $cdocdocb=$s["Document"]; } } $file="$cdocdocb"; header('Content-type: application/pdf'); header('Content-Disposition: inline; filename="$file"'); //@readfile($file); //echo "<p>$file</p>"; ?> <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>utgroup admin</title> <meta content="text/html; charset=utf-8" http-equiv="Content-type" /> <style type="text/css"> #pdf { width: 50%; height: 300px; margin: 2em auto; border: 2px solid red; } #pdf p { padding: 1em; } #pdf object { display: block; border: solid 1px yellow; } </style> </head> <body> <div id="pdf"> <object data="<?php echo @readfile($file);?>" type="application/pdf" width="100%" height="100%"> <p>It appears you don't have a PDF plugin for this browser. No biggie... you can <a href="firehouse_ad_hvvfa_sample1.pdf">click here to download the PDF file.</a></p> </object> </div> </body> </html>  
  12. Na nothing on any of these, and the flash one is a non starter as the guy who will be uploading these just isnt going to be able to do that everytime before uploading. Cant believe there no way of doing this...
  13. Ok will give both a try and see, its a strange one. With the flash approach, do you mean having to change the pdf into a swf before uploading it to the server, or is there a way of converting on the fly so to speak.
  14. I thought something as simple as this would do it, but again the pdf takes over the entire browser window, and no sign of the html including the div that I need on the screen too. <?php session_start(); require_once('../auth.php'); include "../config.php"; error_reporting(E_ALL); ini_set('display_errors','On'); if(isset($_GET['pdf'])) { $stock_Id=$_GET['pdf']; $a=mysql_query("select Document from Documents where ID=$stock_Id") or die (mysql_error()); while($s=mysql_fetch_assoc($a)){ $cdocdocb=$s["Document"]; } } $file="$cdocdocb"; header('Content-type: application/pdf'); header('Content-Disposition: inline; filename="$file"'); //@readfile($file); //echo "<p>$file</p>"; ?> <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>utgroup admin</title> <meta content="text/html; charset=utf-8" http-equiv="Content-type" /> </head> <body> <div style="position:relative; width:100%; height:30px; background-color:#FF0000; margin-bottom:40px; clear:both;"></div> <object data="<?php echo @readfile($file);?>" type="application/pdf" width="100%" height="100%"> <p>It appears you don't have a PDF plugin for this browser. No biggie... you can <a href="myfile.pdf">click here to download the PDF file.</a></p> </object> </body> </html>
  15. The first part of this project was to pull a pdf file which was stored securely on the server into the browser for a user to look at it, but not long after the client asked if I could move the pdf down a bit and put a close button in. Didnt think anytihng of it until I tried and it wasnt so easy, as the pdf always took over the full screen and I couldnt get it to recognise a div i placed on the page. So have tried doing it the way below, which has sort of worked but I get a not as pdf error alert. The user clicks a link to get the page below <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>utgroup admin</title> <meta content="text/html; charset=utf-8" http-equiv="Content-type" /> </head> <body> <div style="position:relative; width:100%; height:30px; background-color:#FF0000; margin-bottom:40px; clear:both;"></div> <object data="spdf.php" type="application/pdf" width="100%" height="100%"> <p>It appears you don't have a PDF plugin for this browser. No biggie... you can <a href="myfile.pdf">click here to download the PDF file.</a></p> </object> </body> </html> Inside that I placed an object to try and pull the other page through which is creating the pdf, but its not quite working, any suggestions. session_start(); require_once('../auth.php'); include "../config.php"; error_reporting(E_ALL); ini_set('display_errors','On'); if(isset($_GET['pdf'])) { $stock_Id=$_GET['pdf']; $a=mysql_query("select Document from Documents where ID=$stock_Id") or die (mysql_error()); while($s=mysql_fetch_assoc($a)){ $cdocdocb=$s["Document"]; } } $file="$cdocdocb"; header('Content-type: application/pdf'); header('Content-Disposition: inline; filename="$file"'); @readfile($file); //echo "<p>$file</p>"; ?>
  16. Hi me again, I'm wondering if its the case that it cant be done, if that is the case, could somebody suggest what the best other option is please Cheers
  17. Hi all, As you will see this is my first post in I really hope somebody can nail this for me, as I have been working on this for some time and I cannot get it to work. Basically this is the final part of a CMS I'm building, and all was fine until I needed to build in an option of a multiple image uploader to accompany all other stock details. I have managed to nail the 'insert' part of the multiple image uploader in this case up to 4 images, and the code is below for this part, any help with improvements though will be greatly appreciated. if(isset($_POST['btnsubmit'])) { $flag=$_POST['flag']; if ($flag==0) { $name=$_POST['txtname']; $desc1=$_POST['e1m1']; $meta=$_POST['txtmeta']; $sr=$_POST['srno1']; $name=$_POST['txtname']; $ref=$_POST['Ref']; $desc=$_POST['e1m1']; $maker=$_POST['Maker']; $date=$_POST['Date']; $weight=$_POST['Weight']; $height=$_POST['Height']; $depth=$_POST['Depth']; $width=$_POST['Width']; $price=$_POST['txtprice']; $sold=$_POST['txtsold']; $active=$_POST['active']; $pcats=$_POST['pcats']; $subcats=$_POST['subcats']; $str_str=''; $p=''; $j=0; for($i=0;$i<=3;$i++){ $j++; $p=$_REQUEST['p$j']; $file=$_FILES['pic']['name'][$i]; if(!empty($file) ){ $str_str.=",pic$j='$file'"; } else if(!empty($p))$str_str.=",pic$j='$p'"; $path1="imgdata/stock/".$file; copy($_FILES['pic']['tmp_name'][$i], $path1); } $q24=mysql_query("update stock set stock_Name='$name', stock_MetaTitle='$meta', parent_Category='$pcats', sub_Category='$subcats', stock_Image='imgdata/stock/$pic[0]', stock_Image2='imgdata/stock/$pic[1]', stock_Image3='imgdata/stock/$pic[2]', stock_Image4='imgdata/stock/$pic[3]', stock_Ref='$ref', stock_Description='$desc1', stock_Maker='$maker', stock_Date='$date', stock_Weight='$weight', stock_Height='$height', stock_Depth='$depth',stock_Width='$width', stock_Price='$price', stock_Sold='$sold', stock_Active='$active', stock_DateTime='$dt2' where stock_Id=$sr") or die (mysql_error()); $flag=1; $conf="Data Updated Successfully - Click <a href='http://www.accendsandbox.co.uk/adminSallam/admin_categories.php'>here</a> to continue"; $update="1"; <tr> <td bgcolor="#A0B050" width="161"> <div style="font-family:Verdana, Arial, Helvetica, sans-serif; position:relative; font-size:12px; color:#293334; font-weight:bold; position:relative; float:left; left:1px;">Stock Image 1 (Main):</div> </td> <td bgcolor="#888888"> <input type="file" name="pic1[]" id="pic1[]" size="50" /> </td> </tr> <tr> <td bgcolor="#A0B050" width="161"> <div style="font-family:Verdana, Arial, Helvetica, sans-serif; position:relative; font-size:12px; color:#293334; font-weight:bold; position:relative; float:left; left:1px;">Stock Image 2:</div> </td> <td bgcolor="#888888"> <input type="file" name="pic1[]" id="pic1[]" size="50" /> </td> </tr> <tr> <td bgcolor="#A0B050" width="161"> <div style="font-family:Verdana, Arial, Helvetica, sans-serif; position:relative; font-size:12px; color:#293334; font-weight:bold; position:relative; float:left; left:1px;">Stock Image 3:</div> </td> <td bgcolor="#888888"> <input type="file" name="pic1[]" id="pic1[]" size="50" /> </td> </tr> <tr> <td bgcolor="#A0B050" width="161"> <div style="font-family:Verdana, Arial, Helvetica, sans-serif; position:relative; font-size:12px; color:#293334; font-weight:bold; position:relative; float:left; left:1px;">Stock Image 4:</div> </td> <td bgcolor="#888888"> <input type="file" name="pic1[]" id="pic1[]" size="50" /> </td> </tr> <input type="submit" name="btnsubmit" value="Submit"> <input type="submit" name="btndelete" value="Delete" DEFANGED_OnClick="return check();"> <input type="hidden" name="srno1" value="<?= $rows["stock_Id"];?>"> <input type="hidden" name="action" value="Upload"> All seems to be fine above, I can upload 1,2,3 or 4 images and the image goes into the server and the path to the database. But I then needed the option for my client to be able to click to edit a certain stock and then aswel as edit the other details, if he wanted to change one pic, no pics or all 4 he could and when he clicked submit, if there was a new image it would change if not it would stay as it is. So here is my attempt and at the moment it doesnt work, so I'm looking for help of any kid and anything can change. $name=$_POST['txtname']; $ref=$_POST['Ref']; $desc=$_POST['e1m1']; $maker=$_POST['Maker']; $date=$_POST['Date']; $weight=$_POST['Weight']; $height=$_POST['Height']; $depth=$_POST['Depth']; $width=$_POST['Width']; $price=$_POST['txtprice']; $sold=$_POST['txtsold']; $meta=$_POST['txtmeta']; $active=$_POST['active']; $pcats=$_POST['pcats']; $subcats=$_POST['subcats']; $pic1=''; for($i=0;$i<4;$i++){ if(isset($_FILES['pic1']['name'][$i]))$pic1[$i]=$_FILES['pic1']['name'][$i]; else $pic1[$i]=''; } for($i=0;$i<4;$i++){ if(isset($_FILES['pic1']['name'][$i]))$path1= "./imgdata/stock/".$_FILES['pic1']['name'][$i]; //echo $_FILES['pic1']['tmp_name'][$i]." :". $path1; if(!empty($_FILES['pic1']['name'][$i])&&isset($_FILES['pic1']['name'][$i]))copy($_FILES['pic1']['tmp_name'][$i], $path1); } $q=mysql_query("insert into stock (stock_Name, stock_MetaTitle, parent_Category, sub_Category, stock_Ref, stock_Description, stock_Maker, stock_Date, stock_Weight, stock_Height, stock_Depth, stock_Width, stock_Price, stock_Sold, stock_Image, stock_Image2, stock_Image3, stock_Image4, stock_Active, stock_DateTime) values('$name','$meta','$pcats','$subcats','$ref','$desc','$maker','$date','$weight','$height','$depth','$width','$price','$sold','imgdata/stock/$pic1[0]','imgdata/stock/$pic1[1]','imgdata/stock/$pic1[2]','imgdata/stock/$pic1[3]','$active','$dt2')") or die (mysql_error()); $conf="Data Inserted Successfully - Click <a href='http://www.accendsandbox.co.uk/adminSallam/admin_stock.php'>here</a> to continue"; $update=1; <tr> <td bgcolor="#A0B050" width="161"> <div style="font-family:Verdana, Arial, Helvetica, sans-serif; position:relative; font-size:12px; color:#293334; font-weight:bold; position:relative; float:left; left:1px;">Stock Image 1 (Main):</div> </td> <td bgcolor="#888888"> <input type="file" name="pic[]" size="50" /> <input type="hidden" name="p1" value="<?php echo $pic1;?>" /> <img src="<?php echo $pic1;?>" height="100px" /> </td> </tr> <tr> <td bgcolor="#A0B050" width="161"> <div style="font-family:Verdana, Arial, Helvetica, sans-serif; position:relative; font-size:12px; color:#293334; font-weight:bold; position:relative; float:left; left:1px;">Stock Image 2:</div> </td> <td bgcolor="#888888"> <input type="file" name="pic[]" size="50" /> <input type="hidden" name="p2" value="<?php echo $pic2;?>" /> <img src="<?php echo $pic2;?>" height="100px" /> </td> </tr> <tr> <td bgcolor="#A0B050" width="161"> <div style="font-family:Verdana, Arial, Helvetica, sans-serif; position:relative; font-size:12px; color:#293334; font-weight:bold; position:relative; float:left; left:1px;">Stock Image 3:</div> </td> <td bgcolor="#888888"> <input type="file" name="pic[]" size="50" /> <input type="hidden" name="p3" value="<?php echo $pic3;?>" /> <img src="<?php echo $pic3;?>" height="100px" /> </td> </tr> <tr> <td bgcolor="#A0B050" width="161"> <div style="font-family:Verdana, Arial, Helvetica, sans-serif; position:relative; font-size:12px; color:#293334; font-weight:bold; position:relative; float:left; left:1px;">Stock Image 4:</div> </td> <td bgcolor="#888888"> <input type="file" name="pic[]" size="50" /> <input type="hidden" name="p4" value="<?php echo $pic4;?>" /> <img src="<?php echo $pic4;?>" height="100px" /> </td> </tr> What happens above as its all on the same page, is when a stock item is selected to be edited the form to update the images changes to the image upload options above, instead of the original ones for a new stock item at the top of this post. I can provide anything you need to help me with this, so please can somebody take a look and see if it can be got working, as its been a long problem for me this. Cheers
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.