Jump to content

joshgarrod

Members
  • Posts

    283
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Male

joshgarrod's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. Thank you, I appreciate your help. I looked more into mime types which I had not really come accross before having only worked with images in the past. I changed "application/doc" to "application/msword" and it works! Thanks again.
  2. Thanks very much for your replies. It has worked for PDF but not for DOC.
  3. Hi, I have a script that currently works for uploading images and I have tried to modify it to upload PDF's and DOC's too, but I can't get it to work - it works fine with JPG or GIF. Any ideas? Thanks in advance. <?php include "scripts/connect.php"; $idir = "../documents/"; // Path To Images Directory if (isset ($_FILES['fupload'])){ $randomd=rand(0000,9999); //upload the image to tmp directory $url = $_FILES['fupload']['name']; // Set $url To Equal The Filename For Later Use if ($_FILES['fupload']['type'] == "image/jpg" || $_FILES['fupload']['type'] == "image/jpeg" || $_FILES['fupload']['type'] == "image/pjpeg" || $_FILES['fupload']['type'] == "image/gif" || $_FILES['fupload']['type'] == "image/pdf" || $_FILES['fupload']['type'] == "image/doc") { $file_ext = strrchr($_FILES['fupload']['name'], '.'); // Get The File Extention In The Format Of , For Instance, .jpg, .gif or .php $copy = copy($_FILES['fupload']['tmp_name'], "$idir" . "$randomd" . $_FILES['fupload']['name']); // Move Image From Temporary Location To Permanent Location } } error_reporting (E_ALL ^ E_NOTICE); if ($_POST['submit']) { $document = mysql_real_escape_string("$idir" . "$randomd" . $_FILES['fupload']['name']); $name = mysql_real_escape_string($_POST['name']); $description = mysql_real_escape_string($_POST['description']); $SQL = " INSERT INTO documents"; $SQL .= " (document, name, description) VALUES "; $SQL .= " ('$document', '$name', '$description') "; $result = mysql_db_query($db,$SQL,$cid); $last=mysql_insert_id(); if (!$result) { echo("ERROR: " . mysql_error() . "\n$SQL\n"); } header("location:document-added.php?ref=$last"); exit(); } ?>[code]
  4. Hi all, I am trying to get a popup javascript calendar working on my form. I have the demo working perfectly on my machine but when i try and add to my site and test in IE I click on the calenndar icon which calls the function to start the calendar and nothing happens. in the bottom corner of IE it informs me there are errors on the page. The error is that "Object Require calendar.js". The script is being sourced in the header of my page at the correct location... any ideas as to where I am going wrong? Thanks in advance: <head> <script language="javaScript" type="text/javascript" src="js/calendar.js"></script> <link href="css/calendar.css" rel="stylesheet" type="text/css"> </head> <form name="fa" action="add-calendar-date.php" method="POST" enctype="multipart/form-data"> <div class="field-hold"> <div class="field-name">Calendar Date Title:</div> <div class="field"><input name="title" type="text" id="title" value="" size="60" /> </div></div> <div class="field-hold"> <div class="field-name">Calendar Date Description:</div> <div class="field"><textarea name="description" cols="45" rows="10" id="description" type="text" value="" /></textarea></div></div> <div class="field-hold"> <div class="field-name">Start Date:</div> <div class="field"><input name="startdate" type="text" id="startdate" value="" size="30" /> <a href="#" onClick="setYears(2011, 2020); showCalender(this, 'startdate');"><img src="images/calendar.png" border="0"></a> </div></div> <div class="field-hold"> <div class="field-name">End Date:</div> <div class="field"><input name="enddate" type="text" id="enddate" value="" size="30" /> <a href="#" onClick="setYears(2011, 2020); showCalender(this, 'enddate');"><img src="images/calendar.png" border="0"></a> </div></div> <div class="field-hold"> <div class="field-name">Start Time:</div> <div class="field"><input name="starttime" type="text" id="starttime" value="" size="30" /> </div></div> <div class="field-hold"> <div class="field-name">End Time:</div> <div class="field"><input name="endtime" type="text" id="endtime" value="" size="30" /> </div></div> <div class="field-hold"> <div class="field-name">Author:</div> <div class="field"><input name="author" type="text" id="author" value="" size="30" /> </div></div> <input name="submit" type="submit" value="Add Calendar Date" /> </form>
  5. Hi, I am having an issue with a piece of code. I am getting the following error, any ideas please? <?php include "scripts/connect.php"; $last = $_GET['ref']; // This will be the ID of the page echo "the ref number is $last"; $query = mysql_query("SELECT * FROM news WHERE `ref` = '$last'"); if(mysql_num_rows($query)==0){ die("Something went wrong, contact Administrator!"); }else{ while($info = mysql_fetch_array($query)){ $title = $info ['title']; echo "<p><a href=\"..news.php\" target=\"_blank\">$title >></a></p>"; } } ?>
  6. Okay, I understand what you are saying. I just wondered if there were any pre-written open source scripts out there that I may be able to disect.
  7. Bascially, I am writing a CMS and the user needs to be able to upload PDF, Doc and XLS files so I need to create an HTML form that uses a PHP script to upload these documents to the server and places a record in the database table to log its name. I hope this is enough info. Thank for your time.
  8. Hi everyone. I have been looking for a PHP upload script that handles various different document types like PDF, DOC and XLS. So far all I have found is image upload scripts. Can anyone point me in the right direction? I would be most greatful. Thank you!
  9. Hi, I am trying to get the background of a div to change when the user is typing in the textfield inside it... sadly I cannot get it to work. Could someone please help me solve this? Thanks in advance... Javascript function changebg() { var docEl = this.parentNode.getElementsByTagName('greenhighlight'); docEl.style.backgroundImage = "url('images/form-highlight-bg.jpg')"; } css .greenhighlight {float:left; width:980px; height:60px;} html <fieldset> <div class="greenhighlight"> <span class="hint">The contact name is the name of the person who is to receive the enquiries for the adverts we submit. This field is required.</span> <label for="contactname"><strong>* Contact Name:</strong></label> <input type="text" id="contactname" onFocus="changebg(greenhighlight);"/> </div> </fieldset>
  10. cheers for that, exactly what I wanted - PHP really does have an answr for everything!
  11. Thats awesome thanks I will try that. $php_mysql$ - I am using a textarea to pull the data from
  12. Yes but that appears to need someone to type \n... how do I get it to do it itself?
  13. Hi all, I am hoping I am able to explain this so here goes: I have a form which inserts data into a table, one field is a textarea. When typing in the textarea you can hit enter to start a new paragraph. But when I pull this info from the database and display it, it appears in one large clump. How do I get PHP to recognise the paragraph? Thanks in advance.
  14. Hi, I am trying to find a piece of databse management software that I can edit locally and syncronise with the live version when needed. I currently use DreamCoder but it is not great. Can anyone suggest anything? Thanks, Josh
×
×
  • 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.