Jump to content

sabatier

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

sabatier's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi folks, I'm doing a college project which involves taking student results from a MySQL database and automatically generating a results transcript in either word or pdf. I have to use the college apache server which means I can't tinker around with php extensions like pdflib. So what are my options? Is is still possible to be able to generate pdf documents from my php with this limitation? Any help appreciated, sabatier
  2. Hi, I'm doing a college project which involves automatically generating student transcripts from a MySQL database. I want to be able to create a system whereby the user enters the student no, and a Word document is automatically generated which displays the student's results in a a letter format. I am able to create the Word document no problem; it's the formatting that I'm having trouble with. If, say, the student is in fourth year, then the Word document must display four sets of results, like the document I attached. So my question is this: What's the best way to generate a Word document like the one I attached, where four year's results will neatly fit on one page? Should I do a HTML template within PHP or have some mechanism to paste the data into a Word template? Or is there a better way to do it? I'd really appreciate your suggestions! sabatier [attachment deleted by admin]
  3. hi everyone, Here is my form to upload a file to my server: <form action="upload.php" method="post" enctype="multipart/form-data" name="frmUpload"> <input name="MAX_FILE_SIZE" id="MAX_FILE_SIZE" type="hidden" value="999999999"> <input name="userfile" type="file"> <input type="submit" value="Send"> </form> And here is upload.php: if ($_FILES['userfile']['error'] > 0) { echo 'Problem: '; switch ($_FILES['userfile']['error']) { case 1: echo 'File exceeded upload_max_filesize'; break; case 2: echo 'File exceeded max_file_size'; break; case 3: echo 'File only partially uploaded'; break; case 4: echo 'No file uploaded'; break; } exit; } // Does the file have the right MIME type? if ($_FILES['userfile']['type'] != 'text/plain') { echo 'Problem: file is not plain text'; exit; } // put the file where we'd like it $upfile = '/uploads/'.$_FILES['userfile']['name']; if (is_uploaded_file($_FILES['userfile']['tmp_name'])) { if (!move_uploaded_file($_FILES['userfile']['tmp_name'], $upfile)) { echo 'Problem: Could not move file to destination directory'; exit; } } else { echo 'Problem: Possible file upload attack. Filename: '; echo $_FILES['userfile']['name']; exit; } echo 'File uploaded successfully<br><br>'; // reformat the file contents $fp = fopen($upfile, 'r'); $contents = fread ($fp, filesize ($upfile)); fclose ($fp); $contents = strip_tags($contents); $fp = fopen($upfile, 'w'); fwrite($fp, $contents); fclose($fp); // show what was uploaded echo 'Preview of uploaded file contents:<br><hr>'; echo $contents; echo '<br><hr>'; file_uploads is on in php.ini. upload_tmp_dir is C:/PHP. No matter what I do, $_FILES and $_POST are empty. print_r($_FILES) returns an empty array. I'm tearing my hair out over this. Can someone please tell me what I'm doing wrong?! Regards, Ruth
  4. Hi this is probably a very simple issue. I have installed PHP with tomcat and apache. When I use <?php echo phpinfo(); ?> it works fine. However nothing else works. For example if I use <?php echo "Hello World"; ?> I get a blank screen. Any ideas what's wrong? Regards, Ruth
  5. Hi all, I'm new to php. Is it possible to implement a popup calendar in php where you can select a date and time without using javascript? Something along the lines of the ones shown here: http://www.softcomplex.com/products/tigra_calendar/demo1.html If possible I want to be able to convert the input to the format "YYYY-MM-DDThh:mm:ss" (this is the dateTime data type used in XML schema). Any help would be greatly appreciated, Ruth
  6. I've checked the file and there's absolutely nothing wrong with it. The funny thing about this script is that it works for some of the *.crl files but not for others...
  7. Hi this is the script I'm using to download a file with a *.crl suffix: <?php $filename = $_GET['file']; // required for IE, otherwise Content-disposition is ignored if(ini_get('zlib.output_compression')) ini_set('zlib.output_compression', 'Off'); // addition by Jorg Weske $file_extension = strtolower(substr(strrchr($filename,"."),1)); if( $filename == "" ) { echo "<html><body>ERROR: download file NOT SPECIFIED. USE download.php?file=filepath</body></html>"; exit; } elseif ( ! file_exists( $filename ) ) { echo "<html><body>ERROR: File not found. USE download.php?file=filepath</body></html>"; exit; }; switch( $file_extension ) { case "crl": $ctype="application/pkcs-crl"; break; case "exe": $ctype="application/octet-stream"; break; case "zip": $ctype="application/zip"; break; case "doc": $ctype="application/msword"; break; case "xls": $ctype="application/vnd.ms-excel"; break; case "ppt": $ctype="application/vnd.ms-powerpoint"; break; case "gif": $ctype="image/gif"; break; case "png": $ctype="image/png"; break; case "jpeg": case "jpg": $ctype="image/jpg"; break; default: $ctype="application/force-download"; } header("Pragma: public"); // required header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private",false); // required for certain browsers header("Content-Type: $ctype"); // change, added quotes to allow spaces in filenames, by Rajkumar Singh header("Content-Disposition: attachment; filename=\"".basename($filename)."\";" ); header("Content-Transfer-Encoding: binary"); header("Content-Length: ".filesize($filename)); readfile("$filename"); exit(); ?> This is how I link to it from my page: <a href='http://localhost:8080/xyz/download.php?file=filename etc etc.. When I click on the link I get the download prompt which shows the proper file size, but it downloads an empty file. The file is definitely there and is not empty... Anyone know what the problem is? Regards, Ruth
×
×
  • 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.