Jump to content

AtlasC1

Members
  • Posts

    38
  • Joined

  • Last visited

Everything posted by AtlasC1

  1. Hi everyone, I've been working on a Drupal-based Laboratory Information Management Systems (LIMS), and am having some issues with zipping files on the fly. It seems that, whenever the total content of the zip exceeds 85 MB, the download fails: the .zip file downloads, but is 0 bytes in size, and a .zip.download file also appears (which gives me the impression the download isn't complete). When I try extracting the .zip, it yields a .zip.cpgz file, which upon extracting, yields another .zip, and so on... Has anyone had an issue similar to this? Could it be timing out? It works fine for any number of files being zipped, as long as the total content is less than 85 MB (seems like the most random number ever). Here is the code that packages the files and sends them to the client: ... if ($filenames != "") { // Create temp zip file fwrite($log, "Generating unique zip filename... "); $tmp = tempnam("/birl/data/", "tempzip"); $tmp_zip = $tmp . ".zip"; fwrite($log, "[success]\n"); // We deliver a zip file header("Content-Type: archive/zip"); // The filename the client will see when downloading header("Content-Disposition: attachment; filename=bulk.zip"); // Zip the files into the tmp_zip file, note that we use very low // compression (1) to ensure rapid processing, and we get rid of paths (j), // so the zip contains only the files within those paths. fwrite($log, "Zipping files... "); $output = shell_exec("zip -0j $tmp_zip $filenames"); fwrite($log, "zip: "); fwrite($log, $output); fwrite($log, "[success]\n"); // Calc the length of the zip; needed for the progress bar of the browser $filesize = filesize($tmp_zip); header("Content-Length: $filesize"); // Keep a file pointer open, so we don't actually delete the file until the script is done $fp = fopen($tmp_zip, 'r'); // Clean up the tmp zip file fwrite($log, "Cleaning up... "); unlink($tmp); unlink($tmp_zip); fwrite($log, "[success]\n"); // Deliver the zip file fwrite($log, "Delivering to client... "); ob_clean(); flush(); fpassthru($fp); fwrite($log, "[success]\n"); } ... Note that if I comment out the calls to unlink and check the resulting .zip file, it is fully intact. So, it appears something goes wrong during the delivery process. Thanks!
  2. jQuery makes it really easy too, check out the first 'Try it Yourself' on w3c Schools jQuery AJAX. Pretty much all it involves is typing: "load('textfilehere.txt');". jm
  3. Yeah, the container of the data in jQuery has to be set to display:none; if you want it to start out in a manner that isn't visible, then have it slide down. -jm
  4. Get rid of the "quotes" around your numerical values. See if that helps. -jm
  5. Did you even read Crono's post? Again, take a look at xpdf and/or pdftohtml -jm
  6. That shouldn't matter; you can pass $count as a variable: function toggleBg(plus) { if (document.getElementById(plus).style.background=="url('/images/minus.png')"){ document.getElementById(plus).style.background="url('/images/plus.png')"; } else { document.getElementById(plus).style.background="url('/images/minus.png')"; } } and use onClick="toggleBg('plus{$count}')" I don't know what your code looks like, so I can't help you with the escape sequences for the quotes, but that shouldn't be hard to figure out. -jm
  7. Rewrite it as a function. You'll save a lot of headache, and the code will be cleaner: function toggleBg() { if (document.getElementById('plus').style.background=="url('/images/minus.png')"){ document.getElementById('plus').style.background="url('/images/plus.png')"; } else { document.getElementById('plus').style.background="url('/images/minus.png')"; } } And on the HTML element your using to trigger this event, use onClick="toggleBg();" -jm
  8. Change your css to: h2.Logo a:focus {outline: none;} And your Logo HTML to: <h2 class="Logo"><a href="index.php">WheresMyIP.Net</a></h2> -jm
  9. Try placing the height specifier in the row rather than the cell. That might work. -jm
  10. This is the first time I've seen the actual page/site as its own object. I've been doing OOP PHP programming for about 4 months now; is this common practice? Normally I take a PHP/Procedural combination, the code seems a lot less complicated. I.E: I would have a standard PHP page with HTML elements for the layout. Then, I would create a Forum object and insert that into the page. The forum object would then have classes within itself (e.g., users, posts, etc.). Maybe I should start rethinking things too... -jm
  11. Yeah, it's best to avoid any system calls whenever you get the chance. P.S: You probably have to set up an exception in SE Linux, if you have it installed, in order for a rm command to work. -jm
  12. Probably PHP. If you go to something like C or C++, you're going to have to change the way you think. Arrays behave entirely differently, as do many other things. So, unless you want to do a lot of learning, I would recommend sticking with PHP, if that's what you're comfortable with. -jm
  13. My guess is that it should probably be: <?php echo 'progress.php?user=' , $session->username ?>"> -jm
  14. Instead of outputting the string directly you could use something like wordwrap(). i.e., wordwrap($string, 88, "<br />\n", true) Is that what you're looking for? -jm
  15. I'm curious and would like to ask everyone here: is ImageMagick still commonly used? I figured it pertains to this thread, and I would also like to know, myself. -jm
  16. I have no idea how that code is relevant to your question. In any case, you don't need javascript. If I understand you correctly, you have an iframe. When the user clicks a link in the iframe, you want the link to affect the parent document (the page that holds the iframe)? You have to use <a href="linkhere.php" target="_parent">text</a> If this isn't the case, please rephrase the question, or someone else will have to help. -jm
  17. You mean you want to take the contents of the specs.php file, and use that as a string? $details = file_get_contents("specs.php"); Like that? If not, perhaps you should rephrase the question... -jm
  18. That's precisely what GET is doing. For example, if you were to go to home.php?pageName=Home, this would automatically create the variable $_GET['pageName'], which would contain the value "Home". Likewise, going to page.php?variable=value, would result in the variable $_GET['variable'] = "value" being created. So, you could use $pageName = $_GET['pageName']; Is this what you mean? -jm
  19. I figured that may be your next question. Instead of using onClick as an event handler, try using onFocus. Another thing I've noticed many people do is start the initial value of the input field as a lighter color: .loginbox { color:#CCC; /* The rest of your style... */ } And, in addition to what you already have in your make_blank() function, you could add document.login.username.style.color ="#000"; It isn't really necessary, just more text effects you could use. So, the username/password fields start off as a light grey color, and when a user types something, the font color will change to black. You'd also want to add this to your undoBlank() function, in order to make it go back to the grey color, if it is changed back to the default value: document.login.username.style.color="#CCC"; -jm
  20. The easiest way to do it is through CSS, using the position property: .fixed { position:fixed; top:30px; right:5px; } This will make anything with the class="fixed" stick to 30px from the top of the browser window, and 5px from the right of the browser window. The div will hover above any other page elements and will not disrupt the natural flow of the website. You could also do this through javascript, to get a smooth, floating appearance. This, however, requires a bit more work. -jm
  21. I would do it the same way you're changing the input value, my friend You can change pretty much any tag's attribute with javascript, which is pretty neat. i.e., function make_blank1() { document.login.password.value =""; document.login.password.type ="password"; } So, when they click in the password field, not only does it change the value to "", but it also changes the type to "password". -jm
  22. The answer to your second question lies in the following line: if(document.login.username.value ="Username") You should be using two '=' signs to do comparisons. Otherwise, this is setting the value to Username and always evaluating as true. So, use: if(document.login.username.value =="Username") And, for your first question, you want to use an onBlur function. For example: Input field: <input type="text" class="loginbox" name="username" value="Username" onclick="make_blank();" onBlur="undoBlank();"> Javascript: function undoBlank() { if(document.login.username.value == ""){ document.login.username.value ="Username"; } } Hope that answers your questions You might also want to add on to your onClick function for the password, setting the type='password', so when people type their password into it, it won't show the characters. -jm
  23. I can't even manage to log in as test/test. Post the HTML/javascript you are trying to run.
  24. Try adding a definite width to the <a> elements; does that work?
×
×
  • 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.